Fluent-Qt

Scrolling

ScrollView

A scrollable viewport with Fluent scrollbars and optional zoom.

Example

ScrollView: Content scrolling and zoom

Usage

Content scrolling and zoom

A large content surface can scroll in both directions and zoom within configured bounds.

#include <FluentQt/Scrolling.h>
using namespace fluent::scrolling;

auto* scrollView = new ScrollView(this);
scrollView->setFixedSize(420, 240);
scrollView->setWidget(new ScrollViewDemoCanvas(
    QSize(760, 520), "Content canvas"));
scrollView->setZoomMode(ScrollView::ZoomMode::Enabled);
scrollView->setMinZoomFactor(0.5);
scrollView->setMaxZoomFactor(2.0);
scrollView->setHorizontalScrollBarVisibility(
    ScrollView::ScrollBarVisibility::Auto);
scrollView->setVerticalScrollBarVisibility(
    ScrollView::ScrollBarVisibility::Auto);

connect(zoomInButton, &QPushButton::clicked,
        scrollView, [scrollView] { scrollView->zoomBy(1.25, true); });
connect(zoomOutButton, &QPushButton::clicked,
        scrollView, [scrollView] { scrollView->zoomBy(0.8, true); });
connect(resetButton, &QPushButton::clicked,
        scrollView, [scrollView] { scrollView->resetZoom(true); });

fluent::scrolling::ScrollView

Inherits QScrollArea · FluentElement · QMLPlus

Scrollable content host with Fluent scroll bars and optional zoom support.

Constructors

Properties

ScrollMode horizontalScrollMode

Horizontal scrolling interaction mode.

Read horizontalScrollMode()Write setHorizontalScrollMode()Notify horizontalScrollModeChanged()
ScrollMode verticalScrollMode

Vertical scrolling interaction mode.

Read verticalScrollMode()Write setVerticalScrollMode()Notify verticalScrollModeChanged()
ScrollBarVisibility horizontalScrollBarVisibility

Visibility policy for the horizontal scrollbar.

Read horizontalScrollBarVisibility()Write setHorizontalScrollBarVisibility()Notify horizontalScrollBarVisibilityChanged()
ScrollBarVisibility verticalScrollBarVisibility

Visibility policy for the vertical scrollbar.

Read verticalScrollBarVisibility()Write setVerticalScrollBarVisibility()Notify verticalScrollBarVisibilityChanged()
ZoomMode zoomMode

Zoom interaction mode.

Read zoomMode()Write setZoomMode()Notify zoomModeChanged()
qreal zoomFactor

Current zoom factor applied to content.

Read zoomFactor()Write setZoomFactor()Notify zoomFactorChanged()
qreal minZoomFactor

Minimum allowed zoom factor.

Read minZoomFactor()Write setMinZoomFactor()Notify minZoomFactorChanged()
qreal maxZoomFactor

Maximum allowed zoom factor.

Read maxZoomFactor()Write setMaxZoomFactor()Notify maxZoomFactorChanged()
bool scrollChainingEnabled

Whether boundary wheel input chains to an enclosing scroller (WinUI ScrollViewer.IsScrollChainingEnabled).

Read isScrollChainingEnabled()Write setScrollChainingEnabled()Notify scrollChainingEnabledChanged()
QWidget* contentWidget

Widget displayed inside the scroll viewport.

Read contentWidget()Write setContentWidget()Notify contentWidgetChanged()
fluent::WidgetOwnership contentOwnership

Release policy for the current content widget.

Read contentOwnership()Notify contentOwnershipChanged()

Methods

void setWidget(QWidget* widget)

Installs content using QScrollArea-compatible owned semantics.

QWidget* takeWidget()

Removes and returns the current content without deleting it.

QWidget* contentWidget() const

Widget displayed inside the scroll viewport.

WidgetOwnership contentOwnership() const

Release policy for the current content widget.

void setContentWidget(QWidget* widget)

Widget displayed inside the scroll viewport.

bool setContentWidget(QWidget* widget, WidgetOwnership ownership)

Installs content with an explicit release policy.

QWidget* takeContentWidget()

Removes and returns content as a parentless caller-owned widget.

ScrollMode horizontalScrollMode() const

Horizontal scrolling interaction mode.

void setHorizontalScrollMode(ScrollMode mode)

Horizontal scrolling interaction mode.

ScrollMode verticalScrollMode() const

Vertical scrolling interaction mode.

void setVerticalScrollMode(ScrollMode mode)

Vertical scrolling interaction mode.

ScrollBarVisibility horizontalScrollBarVisibility() const

Visibility policy for the horizontal scrollbar.

void setHorizontalScrollBarVisibility(ScrollBarVisibility visibility)

Visibility policy for the horizontal scrollbar.

ScrollBarVisibility verticalScrollBarVisibility() const

Visibility policy for the vertical scrollbar.

void setVerticalScrollBarVisibility(ScrollBarVisibility visibility)

Visibility policy for the vertical scrollbar.

ZoomMode zoomMode() const

Zoom interaction mode.

void setZoomMode(ZoomMode mode)

Zoom interaction mode.

qreal zoomFactor() const

Current zoom factor applied to content.

void setZoomFactor(qreal factor)

Current zoom factor applied to content.

qreal minZoomFactor() const

Minimum allowed zoom factor.

void setMinZoomFactor(qreal factor)

Minimum allowed zoom factor.

qreal maxZoomFactor() const

Maximum allowed zoom factor.

void setMaxZoomFactor(qreal factor)

Maximum allowed zoom factor.

bool isScrollChainingEnabled() const

Whether boundary wheel input chains to an enclosing scroller (WinUI ScrollViewer.IsScrollChainingEnabled).

void setScrollChainingEnabled(bool enabled)

Whether boundary wheel input chains to an enclosing scroller (WinUI ScrollViewer.IsScrollChainingEnabled).

Signals

void horizontalScrollModeChanged()

Horizontal scrolling interaction mode.

void verticalScrollModeChanged()

Vertical scrolling interaction mode.

void horizontalScrollBarVisibilityChanged()

Visibility policy for the horizontal scrollbar.

void verticalScrollBarVisibilityChanged()

Visibility policy for the vertical scrollbar.

void zoomModeChanged()

Zoom interaction mode.

void zoomFactorChanged()

Current zoom factor applied to content.

void minZoomFactorChanged()

Minimum allowed zoom factor.

void maxZoomFactorChanged()

Maximum allowed zoom factor.

void scrollChainingEnabledChanged()

Whether boundary wheel input chains to an enclosing scroller (WinUI ScrollViewer.IsScrollChainingEnabled).

void contentWidgetChanged(QWidget* widget)

Widget displayed inside the scroll viewport.

void contentOwnershipChanged(WidgetOwnership ownership)

Release policy for the current content widget.

Enumerations

enum class ScrollMode
  • Disabled
  • Enabled
  • Auto
enum class ScrollBarVisibility
  • Disabled
  • Auto
  • Visible
  • Hidden
enum class ZoomMode
  • Disabled
  • Enabled

Destructors

PySide6 additions

setOwnedContentWidget(widget)

Install content that is deleted when it leaves the host.

setBorrowedContentWidget(widget)

Install content that becomes parentless when it leaves the host.

setReparentedContentWidget(widget)

Install content that returns to its current QWidget parent.

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:QScrollArea

fluent::scrolling::ScrollViewZoomAware

Helper content widget that exposes ScrollView zoom state to layout code.

Methods

Destructors