Fluent-Qt

Basic input

RangeSlider

Lets people select a lower and an upper value by dragging two thumbs along a track.

Example

RangeSlider: Range slider live values

Usage

Range slider live values

Drag either thumb to select a range and mirror both values in external UI.

#include <FluentQt/BasicInput.h>
using namespace fluent::basicinput;

auto* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(8);
auto* slider = new RangeSlider(Qt::Horizontal, this);
slider->setAccessibleName("Price range");
slider->setRange(0, 100);
slider->setValues(20, 64);
slider->setMaximumWidth(260);
auto* status = new Label("Range: 20 to 64", this);
layout->addWidget(slider);
layout->addWidget(status);
connect(slider, &RangeSlider::valuesChanged,
        status, [status](int lower, int upper) {
            status->setText(QString("Range: %1 to %2").arg(lower).arg(upper));
        });

fluent::basicinput::RangeSlider

Inherits QWidget · FluentElement · QMLPlus

Fluent two-thumb slider that selects a lower and an upper value.

Constructors

Properties

Qt::Orientation orientation

Track orientation; vertical sliders place the minimum at the bottom.

Read orientation()Write setOrientation()Notify orientationChanged()
int minimum

Smallest selectable value.

Read minimum()Write setMinimum()Notify rangeChanged()
int maximum

Largest selectable value.

Read maximum()Write setMaximum()Notify rangeChanged()
int lowerValue

Committed lower value.

Read lowerValue()Write setLowerValue()Notify lowerValueChanged()
int upperValue

Committed upper value.

Read upperValue()Write setUpperValue()Notify upperValueChanged()
int minimumRange

Smallest allowed distance between the two values; 0 lets the thumbs meet.

Read minimumRange()Write setMinimumRange()Notify minimumRangeChanged()
int singleStep

Arrow-key step.

Read singleStep()Write setSingleStep()Notify singleStepChanged()
int pageStep

Page Up and Page Down step.

Read pageStep()Write setPageStep()Notify pageStepChanged()
QSlider::TickPosition tickPosition

Tick placement; ticks appear while the pointer is over the control.

Read tickPosition()Write setTickPosition()Notify tickPositionChanged()
int tickInterval

Tick spacing in values; 0 derives it from the steps as QSlider does.

Read tickInterval()Write setTickInterval()Notify tickIntervalChanged()
bool tracking

Whether values commit while dragging; when false they commit on release.

Read hasTracking()Write setTracking()Notify trackingChanged()
Thumb activeThumb

Thumb that receives keyboard input and paints above the other.

Read activeThumb()Write setActiveThumb()Notify activeThumbChanged()

Methods

Qt::Orientation orientation() const

Track orientation; vertical sliders place the minimum at the bottom.

void setOrientation(Qt::Orientation orientation)

Track orientation; vertical sliders place the minimum at the bottom.

int minimum() const

Smallest selectable value.

void setMinimum(int minimum)

Smallest selectable value.

int maximum() const

Largest selectable value.

void setMaximum(int maximum)

Largest selectable value.

void setRange(int minimum, int maximum)

Sets both bounds; a maximum below the minimum becomes the minimum.

int lowerValue() const

Committed lower value.

void setLowerValue(int value)

Committed lower value.

int upperValue() const

Committed upper value.

void setUpperValue(int value)

Committed upper value.

void setValues(int lower, int upper)

Sets both values at once, ordering them and applying minimumRange.

int lowerPosition() const

Visual lower position; differs from lowerValue only while dragging without tracking.

int upperPosition() const

Visual upper position; differs from upperValue only while dragging without tracking.

int minimumRange() const

Smallest allowed distance between the two values; 0 lets the thumbs meet.

void setMinimumRange(int range)

Smallest allowed distance between the two values; 0 lets the thumbs meet.

int singleStep() const

Arrow-key step.

int pageStep() const

Page Up and Page Down step.

void setPageStep(int step)

Page Up and Page Down step.

QSlider::TickPosition tickPosition() const

Tick placement; ticks appear while the pointer is over the control.

void setTickPosition(QSlider::TickPosition position)

Tick placement; ticks appear while the pointer is over the control.

int tickInterval() const

Tick spacing in values; 0 derives it from the steps as QSlider does.

void setTickInterval(int interval)

Tick spacing in values; 0 derives it from the steps as QSlider does.

bool hasTracking() const

Whether values commit while dragging; when false they commit on release.

void setTracking(bool enabled)

Whether values commit while dragging; when false they commit on release.

Thumb activeThumb() const

Thumb that receives keyboard input and paints above the other.

void setActiveThumb(Thumb thumb)

Thumb that receives keyboard input and paints above the other.

bool isSliderDown() const

Whether a thumb is being dragged.

QPoint thumbCenter(Thumb thumb) const

Thumb center in widget coordinates, for layout and accessibility.

Signals

void orientationChanged(Qt::Orientation orientation)

Track orientation; vertical sliders place the minimum at the bottom.

void lowerValueChanged(int value)

Committed lower value.

void upperValueChanged(int value)

Committed upper value.

void valuesChanged(int lower, int upper)

Emitted once after either committed value changes.

void minimumRangeChanged(int range)

Smallest allowed distance between the two values; 0 lets the thumbs meet.

void pageStepChanged(int step)

Page Up and Page Down step.

void tickPositionChanged(QSlider::TickPosition position)

Tick placement; ticks appear while the pointer is over the control.

void tickIntervalChanged(int interval)

Tick spacing in values; 0 derives it from the steps as QSlider does.

void trackingChanged(bool enabled)

Whether values commit while dragging; when false they commit on release.

void activeThumbChanged(Thumb thumb)

Thumb that receives keyboard input and paints above the other.

void sliderPressed()

Emitted when a pointer press starts a drag.

void sliderMoved(int lower, int upper)

Emitted when a dragged position moves, whether or not tracking is enabled.

void sliderReleased()

Emitted once when the drag ends, after the final values commit.

Enumerations

enum class Thumb

Identifies one of the two thumbs.

  • Lower
  • Upper

Destructors

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