Basic input
RatingControl
Lets people view, set, or clear star ratings.
Example

Usage
Rating value
The value signal can update both a caption and an external status label.
#include <FluentQt/BasicInput.h>
using namespace fluent::basicinput;
auto* rating = new RatingControl(this);
rating->setCaption("312 ratings");
connect(rating, &RatingControl::valueChanged,
this, [=](double value) {
rating->setCaption("Your rating");
status->setText(QString("Value: %1").arg(value));
});import fluentqt
rating = fluentqt.RatingControl()
rating.setCaption('312 ratings')
rating.valueChanged.connect(
lambda value: (
rating.setCaption("Your rating"),
status.setText(
"Value: Unset"
if value < 0.0
else f"Value: {value:.1f} stars"
),
)
)API
DeclarationNo matching API members.
fluent::basicinput::RatingControl
Inherits QWidget · FluentElement · QMLPlus
Fluent rating selector with pointer-driven value selection.
Constructors
Properties
double valueSelected rating value committed by the user.
Readvalue()WritesetValue()NotifyvalueChanged()double placeholderValueRating value previewed when no final value is selected.
ReadplaceholderValue()WritesetPlaceholderValue()NotifyplaceholderValueChanged()QString captionSupplemental text displayed next to the rating glyphs.
Readcaption()WritesetCaption()NotifycaptionChanged()bool isClearEnabledWhether the current rating can be cleared by user interaction.
ReadisClearEnabled()WritesetIsClearEnabled()NotifyisClearEnabledChanged()bool isReadOnlyWhether user interaction is blocked while display remains visible.
ReadisReadOnly()WritesetIsReadOnly()NotifyisReadOnlyChanged()int maxRatingMaximum rating value exposed by the control.
ReadmaxRating()WritesetMaxRating()NotifymaxRatingChanged()int starSizeRating glyph size in pixels.
ReadstarSize()WritesetStarSize()NotifystarSizeChanged()Typography::FontRole fontRoleFluent typography role used for text rendering.
ReadfontRole()WritesetFontRole()NotifyfontRoleChanged()Typography::FontRole captionFontRoleFluent typography role used for the rating caption.
ReadcaptionFontRole()WritesetCaptionFontRole()NotifycaptionFontRoleChanged()
Methods
double value() constSelected rating value committed by the user.
void setValue(double value)Selected rating value committed by the user.
double placeholderValue() constRating value previewed when no final value is selected.
void setPlaceholderValue(double value)Rating value previewed when no final value is selected.
QString caption() constSupplemental text displayed next to the rating glyphs.
void setCaption(const QString& caption)Supplemental text displayed next to the rating glyphs.
bool isClearEnabled() constWhether the current rating can be cleared by user interaction.
void setIsClearEnabled(bool enabled)Whether the current rating can be cleared by user interaction.
bool isReadOnly() constWhether user interaction is blocked while display remains visible.
void setIsReadOnly(bool readOnly)Whether user interaction is blocked while display remains visible.
int maxRating() constMaximum rating value exposed by the control.
void setMaxRating(int rating)Maximum rating value exposed by the control.
int starSize() constRating glyph size in pixels.
void setStarSize(int size)Rating glyph size in pixels.
Typography::FontRole fontRole() constFluent typography role used for text rendering.
void setFontRole(Typography::FontRole role)Fluent typography role used for text rendering.
Typography::FontRole captionFontRole() constFluent typography role used for the rating caption.
void setCaptionFontRole(Typography::FontRole role)Fluent typography role used for the rating caption.
Signals
void valueChanged(double value)Selected rating value committed by the user.
void placeholderValueChanged(double value)Rating value previewed when no final value is selected.
void captionChanged(const QString& caption)Supplemental text displayed next to the rating glyphs.
void isClearEnabledChanged(bool enabled)Whether the current rating can be cleared by user interaction.
void isReadOnlyChanged(bool readOnly)Whether user interaction is blocked while display remains visible.
void maxRatingChanged(int rating)Maximum rating value exposed by the control.
void starSizeChanged(int size)Rating glyph size in pixels.
void fontRoleChanged()Fluent typography role used for text rendering.
void captionFontRoleChanged()Fluent typography role used for the rating caption.
Subclass interfaces
Methods
Inherited from fluent::FluentElement
Methods
static void setTheme(Theme theme)Updates the global theme and notifies active FluentElement instances.
static void setThemeDeferred(Theme theme)Schedules a visible-first batched theme refresh without blocking the current interaction.
static Theme currentTheme()Returns the currently active global theme.
static bool themeUsesDarkAppearance(Theme theme)Returns whether a theme uses dark-backed chrome and material tokens.
static void refreshTheme()Re-broadcasts the current theme to repaint after a design-token change.
static int themeGeneration()Monotonic counter bumped on every theme change, for staleness checks.
Theme effectiveTheme() constResolves the theme used by this element, honoring an inherited QWidget override.
bool effectiveThemeUsesDarkAppearance() constReturns whether this element's effective theme uses dark-backed chrome.
bool setThemeOverrides(const QJsonObject& overrides)Component-facing token accessors.
QJsonObject themeOverrides() constReturns this element's authored overrides.
void clearThemeOverrides()Restores all token fields to global theme defaults.
const Colors& themeColorsRef() constNon-copying access to the active color set (for hot paint paths).
Material::AcrylicToken themeAcrylic() constMaterial, elevation, and adaptive layout tokens.
QColor themeBackdrop(bool active) constWindow-chrome backdrop color for the given activation state.
virtual void onThemeUpdated()Called after the global theme changes.
Enumerations
enum ThemeGlobal visual theme used when resolving design tokens.
Light = 0Dark = 1HighContrast = 2
Types and aliases
struct ColorsDesign token snapshots returned to components.
Inherited from fluent::QMLPlus
Methods
AnchorLayout::Anchors* anchors()Returns mutable anchors for the QWidget host.
void setState(const QString& name)Applies a named state, or clears state when name is empty.
void addState(const QMLState& state)Registers or replaces a named state definition.
void evaluateStates()Reevaluates conditions; the first registered true condition wins.
QMLPlusRuntime* runtime()Returns the lazy host-owned state observation object.
void setAnchors(const AnchorLayout::Anchors& anchors)Replaces all host anchors and invalidates the parent layout.
void resetAnchors()Clears all host anchors and invalidates the parent layout.
void bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)Binds a source property to a property on the QWidget host.
BindingHandle bindManaged(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction direction = PropertyBinder::OneWay, BindingOptions options = {})Installs a managed direct binding on this QWidget host.
BindingHandle bindComputed(const char* targetProp, const QVector<BindingDependency>& dependencies, std::function<QVariant()> evaluate, BindingOptions options = {})Installs an explicit-dependency C++ expression on this QWidget host.
void addTransition(const StateTransition& transition)Registers a state transition in precedence order.
void setBehavior(const char* propertyName, const PropertyAnimation& animation)Sets the default animation for this host's managed property writes.
void clearBehavior(const char* propertyName)Removes the default animation for future managed writes.
bool writeProperty(const char* propertyName, const QVariant& value)Writes a host property through Behavior without removing its binding.
All inherited Qt members:QWidget