Scrolling
AnnotatedScrollBar
A scrollbar with labels that make long content easier to navigate.
Example

Usage
Labeled scroll range with details
Labels mark notable offsets and the detail provider resolves hover text.
#include <FluentQt/Scrolling.h>
using namespace fluent::scrolling;
auto* bar = new AnnotatedScrollBar(this);
bar->setRange(0, 960);
bar->setPageStep(120);
bar->setLabels({
{"2023", 0, "October 2023"},
{"2022", 120, "October 2022"},
{"2021", 240, "October 2021"},
{"2020", 360, "October 2020"},
{"2019", 480, "October 2019"},
{"2018", 600, "October 2018"},
{"2017", 720, "October 2017"},
{"2016", 840, "October 2016"},
{"2015", 960, "October 2015"}
});
bar->setDetailLabelProvider([](int offset) {
const int year = 2023 - std::clamp(offset / 120, 0, 8);
return QStringLiteral("October %1").arg(year);
});import fluentqt
bar = fluentqt.AnnotatedScrollBar()
bar.setRange(0, 960)
bar.setPageStep(120)
bar.setLabels(
[
fluentqt.AnnotatedScrollBarLabel("2023", 0, "October 2023"),
fluentqt.AnnotatedScrollBarLabel("2022", 120, "October 2022"),
fluentqt.AnnotatedScrollBarLabel("2021", 240, "October 2021"),
fluentqt.AnnotatedScrollBarLabel("2020", 360, "October 2020"),
fluentqt.AnnotatedScrollBarLabel("2019", 480, "October 2019"),
fluentqt.AnnotatedScrollBarLabel("2018", 600, "October 2018"),
fluentqt.AnnotatedScrollBarLabel("2017", 720, "October 2017"),
fluentqt.AnnotatedScrollBarLabel("2016", 840, "October 2016"),
fluentqt.AnnotatedScrollBarLabel("2015", 960, "October 2015"),
]
)
def detail_for_offset(offset):
year = 2023 - max(0, min(offset // 120, 8))
return f"October {year}"
bar.setDetailLabelProvider(detail_for_offset)API
DeclarationNo matching API members.
fluent::scrolling::AnnotatedScrollBar
Inherits QWidget · FluentElement · QMLPlus
Vertical Fluent scrollbar with offset labels and optional detail tooltip.
Constructors
Properties
int minimumMinimum scroll value mirrored from the connected ScrollView or set directly.
Readminimum()WritesetMinimum()NotifyrangeChanged()int maximumMaximum scroll value mirrored from the connected ScrollView or set directly.
Readmaximum()WritesetMaximum()NotifyrangeChanged()int valueCurrent scroll value that drives thumb and annotation positions.
Readvalue()WritesetValue()NotifyvalueChanged()int pageStepPage step used for scroll or range movement.
ReadpageStep()WritesetPageStep()NotifypageStepChanged()QSize preferredSizePreferred visual size of the control.
ReadpreferredSize()WritesetPreferredSize()NotifylayoutMetricsChanged()QSize minimumBarSizeMinimum rendered scrollbar size.
ReadminimumBarSize()WritesetMinimumBarSize()NotifylayoutMetricsChanged()int verticalPaddingVertical padding inside the control.
ReadverticalPadding()WritesetVerticalPadding()NotifylayoutMetricsChanged()QSize caretSizeCaret glyph size used by scroll affordances.
ReadcaretSize()WritesetCaretSize()NotifylayoutMetricsChanged()int labelColumnWidthWidth reserved for annotated labels.
ReadlabelColumnWidth()WritesetLabelColumnWidth()NotifylayoutMetricsChanged()int labelLineHeightLine height used by annotated labels.
ReadlabelLineHeight()WritesetLabelLineHeight()NotifylayoutMetricsChanged()int minimumLabelSpacingMinimum spacing kept between visible labels.
ReadminimumLabelSpacing()WritesetMinimumLabelSpacing()NotifylayoutMetricsChanged()int indicatorWidthWidth of the scroll position indicator area.
ReadindicatorWidth()WritesetIndicatorWidth()NotifylayoutMetricsChanged()int indicatorThicknessPainted thickness of the scroll position indicator.
ReadindicatorThickness()WritesetIndicatorThickness()NotifylayoutMetricsChanged()int lineStepFallbackFallback line step when no connected scroll view provides one.
ReadlineStepFallback()WritesetLineStepFallback()NotifylayoutMetricsChanged()
Methods
int minimum() constMinimum scroll value mirrored from the connected ScrollView or set directly.
int maximum() constMaximum scroll value mirrored from the connected ScrollView or set directly.
int value() constCurrent scroll value that drives thumb and annotation positions.
int pageStep() constPage step used for scroll or range movement.
QSize preferredSize() constPreferred visual size of the control.
QSize minimumBarSize() constMinimum rendered scrollbar size.
int verticalPadding() constVertical padding inside the control.
QSize caretSize() constCaret glyph size used by scroll affordances.
int labelColumnWidth() constWidth reserved for annotated labels.
int labelLineHeight() constLine height used by annotated labels.
int minimumLabelSpacing() constMinimum spacing kept between visible labels.
int indicatorWidth() constWidth of the scroll position indicator area.
int indicatorThickness() constPainted thickness of the scroll position indicator.
int lineStepFallback() constFallback line step when no connected scroll view provides one.
void setMinimum(int minimum)Minimum scroll value mirrored from the connected ScrollView or set directly.
void setMaximum(int maximum)Maximum scroll value mirrored from the connected ScrollView or set directly.
void setValue(int value)Current scroll value that drives thumb and annotation positions.
void setPageStep(int pageStep)Page step used for scroll or range movement.
void setPreferredSize(const QSize& size)Preferred visual size of the control.
void setMinimumBarSize(const QSize& size)Minimum rendered scrollbar size.
void setVerticalPadding(int padding)Vertical padding inside the control.
void setCaretSize(const QSize& size)Caret glyph size used by scroll affordances.
void setLabelColumnWidth(int width)Width reserved for annotated labels.
void setLabelLineHeight(int height)Line height used by annotated labels.
void setMinimumLabelSpacing(int spacing)Minimum spacing kept between visible labels.
void setIndicatorWidth(int width)Width of the scroll position indicator area.
void setIndicatorThickness(int thickness)Painted thickness of the scroll position indicator.
void setLineStepFallback(int step)Fallback line step when no connected scroll view provides one.
QVector<AnnotatedScrollBarLabel> labels() constReturns all authored labels, including labels hidden by collision filtering.
void setLabels(const QVector<AnnotatedScrollBarLabel>& labels)Replaces all labels and invalidates visible-label layout.
void setDetailLabelProvider(DetailLabelProvider provider)Installs a provider used when a hovered label needs detail text.
void connectToScrollView(ScrollView* scrollView)Mirrors range/value from a ScrollView and sends scroll requests back to it.
QVector<AnnotatedScrollBarLabel> visibleLabels() constReturns the collision-filtered labels currently eligible for painting.
Signals
void rangeChanged(int minimum, int maximum)Property and interaction notifications.
void valueChanged(int value)Current scroll value that drives thumb and annotation positions.
void pageStepChanged(int pageStep)Page step used for scroll or range movement.
void layoutMetricsChanged()Preferred visual size of the control.
void scrollRequested(int offset)Emitted when user interaction requests scrolling to an offset.
Types and aliases
using DetailLabelProvider = std::function<QString(int offset)>Callback that resolves detail text for a scroll offset.
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() 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
fluent::scrolling::AnnotatedScrollBarLabel
Label metadata rendered beside an AnnotatedScrollBar offset.