Fluent-Qt

Collections

StackView

A stack-based container that pushes and pops pages with transitions.

Example

StackView: Push and pop pages

Usage

Push and pop pages

StackView keeps a navigation stack of pages with transitions.

#include <FluentQt/Collections.h>
using namespace fluent::collections;

auto* stackView = new StackView(this);
stackView->setInitialItem(firstPage);
stackView->push(nextPage);
stackView->pop();
QObject::connect(stackView, &StackView::depthChanged,
                 status, updateStatus);

fluent::collections::StackView

Inherits QStackedWidget · FluentElement · QMLPlus

Stacked page host with push/pop navigation semantics.

Constructors

Properties

int depth

Number of pages currently in the stack.

Read depth()Notify depthChanged()
QWidget* currentItem

Currently visible stack page.

Read currentItem()Notify currentItemChanged()
QWidget* initialItem

Initial page inserted into the stack.

Read initialItem()Write setInitialItem()Notify initialItemChanged()
bool busy

Whether a transition or navigation operation is running.

Read busy()Notify busyChanged()
Qt::Orientation orientation

Primary layout or motion orientation.

Read orientation()Write setOrientation()Notify orientationChanged()
bool transitionAnimationEnabled

Whether stack transition animation is enabled.

Read transitionAnimationEnabled()Write setTransitionAnimationEnabled()Notify transitionAnimationEnabledChanged()
int transitionDuration

Stack transition duration in milliseconds.

Read transitionDuration()Write setTransitionDuration()Notify transitionDurationChanged()
StackViewTransitionType transitionType

Transition effect used for stack navigation.

Read transitionType()Write setTransitionType()Notify transitionTypeChanged()
fluent::WidgetOwnership defaultItemOwnership

Default release policy for pages added through StackView APIs.

Read defaultItemOwnership()Write setDefaultItemOwnership()Notify defaultItemOwnershipChanged()

Methods

int depth() const

Number of pages currently in the stack.

QWidget* currentItem() const

Currently visible stack page.

QWidget* initialItem() const

Initial page inserted into the stack.

bool busy() const

Whether a transition or navigation operation is running.

Qt::Orientation orientation() const

Primary layout or motion orientation.

void setOrientation(Qt::Orientation orientation)

Primary layout or motion orientation.

bool transitionAnimationEnabled() const

Whether stack transition animation is enabled.

void setTransitionAnimationEnabled(bool enabled)

Whether stack transition animation is enabled.

int transitionDuration() const

Stack transition duration in milliseconds.

void setTransitionDuration(int durationMs)

Stack transition duration in milliseconds.

StackViewTransitionType transitionType() const

Transition effect used for stack navigation.

void setTransitionType(StackViewTransitionType type)

Transition effect used for stack navigation.

WidgetOwnership defaultItemOwnership() const

Default release policy for pages added through StackView APIs.

void setDefaultItemOwnership(WidgetOwnership ownership)

Default release policy for pages added through StackView APIs.

void setInitialItem(QWidget* item)

Initial page inserted into the stack.

bool adoptWidget(QWidget* item, WidgetOwnership ownership = WidgetOwnership::Borrowed)

Adds a page to StackView navigation tracking without taking ownership by default.

Signals

void depthChanged(int depth)

Number of pages currently in the stack.

void currentItemChanged(QWidget* item)

Currently visible stack page.

void initialItemChanged(QWidget* item)

Initial page inserted into the stack.

void busyChanged(bool busy)

Whether a transition or navigation operation is running.

void orientationChanged(Qt::Orientation orientation)

Primary layout or motion orientation.

void transitionAnimationEnabledChanged(bool enabled)

Whether stack transition animation is enabled.

void transitionDurationChanged(int durationMs)

Stack transition duration in milliseconds.

void transitionTypeChanged(StackViewTransitionType type)

Transition effect used for stack navigation.

void defaultItemOwnershipChanged(WidgetOwnership ownership)

Default release policy for pages added through StackView APIs.

Enumerations

enum class StackViewItemStatus
  • Inactive
  • Activating
  • Active
  • Deactivating
enum class StackViewTransitionType
  • SlideFade
  • ScaleFade
  • Immediate

Destructors

PySide6 additions

setInitialOwnedItem(page)

Reset the stack to an Owned page, or clear it for ``None``.

setInitialBorrowedItem(page)

Reset the stack to a page detached when it leaves the host.

setInitialReparentedItem(page)

Reset the stack to a page restored to its current parent.

pushOwnedItem(page)

Push an Owned page.

pushBorrowedItem(page)

Push a page that becomes parentless after pop.

pushReparentedItem(page)

Push a page restored to its current parent after pop.

pushOwnedItems(pages)

Push multiple Owned pages in one native transition.

pushBorrowedItems(pages)

Push multiple pages that become parentless when removed.

pushReparentedItems(pages)

Push multiple pages restored to their current parents.

replaceOwnedItem(page)

Replace the current page with an Owned page.

replaceBorrowedItem(page)

Replace the current page with a Borrowed page.

replaceReparentedItem(page)

Replace the current page with a Reparented page.

replaceOwnedItemAt(index, page)

Replace a page at ``index`` with an Owned page.

replaceBorrowedItemAt(index, page)

Replace a page at ``index`` with a Borrowed page.

replaceReparentedItemAt(index, page)

Replace a page at ``index`` with a Reparented page.

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