Fluent-Qt

Basic input

RatingControl

Lets people view, set, or clear star ratings.

Example

RatingControl: Rating value

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));
        });

fluent::basicinput::RatingControl

Inherits QWidget · FluentElement · QMLPlus

Fluent rating selector with pointer-driven value selection.

Constructors

Properties

double value

Selected rating value committed by the user.

Read value()Write setValue()Notify valueChanged()
double placeholderValue

Rating value previewed when no final value is selected.

Read placeholderValue()Write setPlaceholderValue()Notify placeholderValueChanged()
QString caption

Supplemental text displayed next to the rating glyphs.

Read caption()Write setCaption()Notify captionChanged()
bool isClearEnabled

Whether the current rating can be cleared by user interaction.

Read isClearEnabled()Write setIsClearEnabled()Notify isClearEnabledChanged()
bool isReadOnly

Whether user interaction is blocked while display remains visible.

Read isReadOnly()Write setIsReadOnly()Notify isReadOnlyChanged()
int maxRating

Maximum rating value exposed by the control.

Read maxRating()Write setMaxRating()Notify maxRatingChanged()
int starSize

Rating glyph size in pixels.

Read starSize()Write setStarSize()Notify starSizeChanged()
Typography::FontRole fontRole

Fluent typography role used for text rendering.

Read fontRole()Write setFontRole()Notify fontRoleChanged()
Typography::FontRole captionFontRole

Fluent typography role used for the rating caption.

Read captionFontRole()Write setCaptionFontRole()Notify captionFontRoleChanged()

Methods

double value() const

Selected rating value committed by the user.

void setValue(double value)

Selected rating value committed by the user.

double placeholderValue() const

Rating value previewed when no final value is selected.

void setPlaceholderValue(double value)

Rating value previewed when no final value is selected.

QString caption() const

Supplemental text displayed next to the rating glyphs.

void setCaption(const QString& caption)

Supplemental text displayed next to the rating glyphs.

bool isClearEnabled() const

Whether 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() const

Whether user interaction is blocked while display remains visible.

void setIsReadOnly(bool readOnly)

Whether user interaction is blocked while display remains visible.

int maxRating() const

Maximum rating value exposed by the control.

void setMaxRating(int rating)

Maximum rating value exposed by the control.

int starSize() const

Rating glyph size in pixels.

void setStarSize(int size)

Rating glyph size in pixels.

Typography::FontRole fontRole() const

Fluent typography role used for text rendering.

void setFontRole(Typography::FontRole role)

Fluent typography role used for text rendering.

Typography::FontRole captionFontRole() const

Fluent 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() const

Resolves the theme used by this element, honoring an inherited QWidget override.

bool effectiveThemeUsesDarkAppearance() const

Returns whether this element's effective theme uses dark-backed chrome.

QJsonObject themeOverrides() const

Returns this element's authored overrides.

void clearThemeOverrides()

Restores all token fields to global theme defaults.

const Colors& themeColorsRef() const

Non-copying access to the active color set (for hot paint paths).

Material::AcrylicToken themeAcrylic() const

Material, elevation, and adaptive layout tokens.

QColor themeBackdrop(bool active) const

Window-chrome backdrop color for the given activation state.

virtual void onThemeUpdated()

Called after the global theme changes.

Enumerations

enum Theme

Global visual theme used when resolving design tokens.

  • Light = 0
  • Dark = 1
  • HighContrast = 2

Types and aliases

struct Colors

Design 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 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