Fluent-Qt

Navigation

NavigationView

An adaptive left pane plus content area for top-level navigation.

Example

NavigationView: Chrome slots

Usage

Chrome slots

Header, main, and footer chrome are caller-owned widgets; NavigationView only assigns their shell geometry.

#include <FluentQt/Navigation.h>
using namespace fluent::navigation;

auto* navView = new NavigationView(this);
navView->setMinimumWidth(440);
navView->setMaximumWidth(620);
navView->setFixedHeight(340);
navView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
navView->setDisplayMode(NavigationView::DisplayMode::Left);
navView->setExpandedPaneWidth(180);
navView->setHeaderChromeWidget(headerSection);
navView->setMainChromeWidget(mainSection);
navView->setFooterChromeWidget(footerSection);
populateNavigationPages(navView->contentHost());
auto routeToPage = [host = navView->contentHost()](int pageIndex) {
    const int direction = pageIndex >= host->currentIndex() ? 1 : -1;
    host->setCurrentIndex(pageIndex, direction, true);
};
headerSection->onActivated = routeToPage;
mainSection->onActivated = routeToPage;
footerSection->onActivated = routeToPage;

fluent::navigation::NavigationView

Inherits QWidget · FluentElement · QMLPlus

Lightweight navigation shell with pane display modes and content hosting.

Constructors

Properties

DisplayMode displayMode

Requested navigation layout mode before responsive constraints are applied.

Read displayMode()Write setDisplayMode()Notify displayModeChanged()
DisplayMode effectiveDisplayMode

Display mode after responsive constraints are applied.

Read effectiveDisplayMode()Notify effectiveDisplayModeChanged()
bool paneOpen

Whether the navigation pane is open.

Read isPaneOpen()Write setPaneOpen()Notify paneOpenChanged()
int compactModeThresholdWidth

Width threshold for compact navigation mode.

Read compactModeThresholdWidth()Write setCompactModeThresholdWidth()Notify compactModeThresholdWidthChanged()
int expandedModeThresholdWidth

Width threshold for expanded navigation mode.

Read expandedModeThresholdWidth()Write setExpandedModeThresholdWidth()Notify expandedModeThresholdWidthChanged()
int expandedPaneWidth

Navigation pane width in expanded mode.

Read expandedPaneWidth()Write setExpandedPaneWidth()Notify expandedPaneWidthChanged()
int compactPaneWidth

Navigation pane width in compact mode.

Read compactPaneWidth()Write setCompactPaneWidth()Notify compactPaneWidthChanged()
int topBarHeight

Top navigation bar height in pixels.

Read topBarHeight()Write setTopBarHeight()Notify topBarHeightChanged()
bool animationEnabled

Whether pane and layout-mode transitions are animated.

Read isAnimationEnabled()Write setAnimationEnabled()Notify animationEnabledChanged()
qreal layoutTransitionProgress

Progress used by navigation layout transitions.

Read layoutTransitionProgress()Write setLayoutTransitionProgress()

Methods

DisplayMode displayMode() const

Requested navigation layout mode before responsive constraints are applied.

void setDisplayMode(DisplayMode mode)

Requested navigation layout mode before responsive constraints are applied.

DisplayMode effectiveDisplayMode() const

Display mode after responsive constraints are applied.

bool isPaneOpen() const

Whether the navigation pane is open.

void setPaneOpen(bool open)

Whether the navigation pane is open.

int compactModeThresholdWidth() const

Width threshold for compact navigation mode.

void setCompactModeThresholdWidth(int width)

Width threshold for compact navigation mode.

int expandedModeThresholdWidth() const

Width threshold for expanded navigation mode.

void setExpandedModeThresholdWidth(int width)

Width threshold for expanded navigation mode.

int expandedPaneWidth() const

Navigation pane width in expanded mode.

void setExpandedPaneWidth(int width)

Navigation pane width in expanded mode.

int compactPaneWidth() const

Navigation pane width in compact mode.

void setCompactPaneWidth(int width)

Navigation pane width in compact mode.

int topBarHeight() const

Top navigation bar height in pixels.

void setTopBarHeight(int height)

Top navigation bar height in pixels.

bool isAnimationEnabled() const

Whether pane and layout-mode transitions are animated.

void setAnimationEnabled(bool enabled)

Whether pane and layout-mode transitions are animated.

bool setHeaderChromeWidget(QWidget* widget, WidgetOwnership ownership)

Sets header chrome with an explicit release policy.

QWidget* takeHeaderChromeWidget()

Transfers the header chrome to the caller without applying its policy.

bool releaseHeaderChromeWidget()

Removes the header chrome and applies its configured policy.

bool setMainChromeWidget(QWidget* widget, WidgetOwnership ownership)

Sets main chrome with an explicit release policy.

QWidget* takeMainChromeWidget()

Transfers the main chrome to the caller without applying its policy.

bool releaseMainChromeWidget()

Removes the main chrome and applies its configured policy.

Signals

void displayModeChanged(DisplayMode mode)

Requested navigation layout mode before responsive constraints are applied.

void effectiveDisplayModeChanged(DisplayMode mode)

Display mode after responsive constraints are applied.

void paneOpenChanged(bool open)

Whether the navigation pane is open.

void compactModeThresholdWidthChanged(int width)

Width threshold for compact navigation mode.

void expandedModeThresholdWidthChanged(int width)

Width threshold for expanded navigation mode.

void expandedPaneWidthChanged(int width)

Navigation pane width in expanded mode.

void compactPaneWidthChanged(int width)

Navigation pane width in compact mode.

void topBarHeightChanged(int height)

Top navigation bar height in pixels.

void animationEnabledChanged(bool enabled)

Whether pane and layout-mode transitions are animated.

Enumerations

enum class DisplayMode
  • Auto
  • Left
  • LeftCompact
  • LeftMinimal
  • Top

Destructors

PySide6 additions

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