Navigation¶
NavigationBar / NavigationView¶
The main window's side navigation; compact/expanded form is decided by the window WindowType. Use window.addPage() to add nav items.
Standalone use inside a page¶
Both are plain Items, so they can be placed in a page without the window shell (the Gallery's "Vertical navigation" section does exactly that). Two things matter when you do:
① Selection is a single-direction binding: the host must push it back. A panel only emits itemClicked(index) and never writes currentIndex itself — that keeps the "window → navigation" binding one-way:
NavigationView {
model: [
{ key: "home", text: "Home", icon: ... },
{ key: "docs", text: "Documents", icon: ... }
]
onItemClicked: (index) => currentIndex = index // inside a page, this IS the host shell
}
ToggleNavigationBar is controlled just like NavigationView: a click only emits itemClicked(index) and never writes currentIndex, so standalone use inside a page must wire the write-back. See Selection-index binding contract below:
Clicking a group header only toggles it and never switches pages, so it needs no extra handling.
② titleBarHeight defaults to the window title-bar height. A page has no title bar, so leaving it alone reserves dead space at the top (measured at 48px, which pushes every row down):
NavigationView {
titleBarHeight: 0 // no title bar inside a page
showReturnButton: false // and no return button either
}
Pane display mode¶
paneDisplayMode lets the pane decide its own form instead of hand-managing isExpanded:
| Mode | Behaviour |
|---|---|
Enums.navigation.pane_unspecified (default) |
Never touches isExpanded; behaviour is exactly as before |
pane_auto |
Expanded while the pane is at least Enums.controlSize.navPanelExpandWidth wide, compact otherwise |
pane_left |
Always the expanded sidebar |
pane_left_compact |
Always the compact icon rail |
pane_left_minimal |
Collapsed to the menu button; openPane() / togglePane() reveal the rail in place, and the menu button toggles it |
Fluent.NavigationView {
paneDisplayMode: Enums.navigation.pane_auto
// with pane_left_minimal use isPaneOpen / openPane() / closePane() / togglePane()
}
Once a mode is set, the mode owns isExpanded — "expanded or not" is exactly what it decides. Only pane_unspecified opts out and leaves the value to the caller.
The pane's own menu button expands and collapses the same instance, so no control has to be cloned per mode:
| Mode | Menu button behaviour |
|---|---|
pane_left |
toggle(): expanded sidebar ↔ compact icon rail |
pane_left_compact |
toggle(): clicking expands the collapsed rail |
pane_left_minimal |
togglePane(): opens and closes the overlay pane (isPaneOpen) |
pane_auto looks only at the pane's own width, so responsive hosts just give it a width; the Gallery demonstrates the switch point with a slider.
A top strip is deliberately out of paneDisplayMode's scope: that belongs to the window shell, and WindowsBar currently hosts it with NavigationBar.
Return button¶
The return arrow at the top of NavigationView only emits returnButtonClicked(); the host decides where it goes. With returnButtonEnabled: false the arrow is greyed and ignores hover and clicks.
WindowType.SPLIT windows wire it up: they record visited pages (switches from items, bottom items and navigateTo all count, and a page repeated in a row is recorded once), the button returns to the previous page, and going back records nothing; with no previous page the button is greyed. The history survives only when the page list is extended at its end. Any other change to the navigation items (insert, remove, reorder, replacing a page with a group header, or adding a top page while bottom pages exist) clears it, so going back never lands on a page that no longer exists.
NavigationView keeps no history itself and has no go-back method. For standalone use the host must maintain the stack itself:
Item {
id: host
property var visited: [0] // host-owned stack of visited pages; the last one is current
NavigationView {
id: nav
model: navigationItems
titleBarHeight: 0
returnButtonEnabled: host.visited.length > 1
onItemClicked: (index) => {
if (index !== nav.currentIndex) host.visited = host.visited.concat([index])
nav.currentIndex = index // controlled: the host writes it back
}
onReturnButtonClicked: {
host.visited = host.visited.slice(0, -1)
nav.currentIndex = host.visited[host.visited.length - 1]
}
}
}
Grouping and in-place expansion¶
NavigationView and ToggleNavigationBar can collect items into collapsible groups. Expanding a group inserts its children in place below the parent row, indented one level.
Group headers own no page slot. The engine handles this automatically: page indices are allocated only to page-bearing rows, and headers are skipped entirely. Inserting a header therefore never renumbers an existing page, and no placeholder pages are needed.
Fluent.NavigationView {
model: [
{ "text": "Content", "isGroup": true }, // header, no page
{ "text": "Articles", "parent": "Content", "icon": ... }, // page 0
{ "text": "Comments", "parent": "Content", "icon": ... }, // page 1
{ "text": "Settings" } // page 2
]
}
On the Python side use addGroup together with addPage(parent=...):
window.addGroup("Content", "Folder")
window.addPage(ArticlePage, "Document", "Articles", parent="Content")
window.addPage(CommentPage, "Comment", "Comments", parent="Content")
window.addPage(SettingsPage, "Settings", "Settings")
C++ mirrors this exactly:
w.addGroup("Content", "Folder");
w.addPage("pages/Article.qml", "Document", "Articles", NavPosition::Top,
true, true, "Content");
Behaviour and limits:
| Behaviour | Detail |
|---|---|
| Group header | isGroup: true; owns no page slot, clicking only toggles it |
| Unique group text | Children resolve parent to the first row with that text, so a group header's text must be unique in the whole model, translated text included. A page row sharing the header's text becomes its own parent: it is treated as a self-referencing top-level row and shares the header's children, which then appear twice |
| Page row with children | A non-group row that has children only toggles on click: it is not selected and emits no itemClicked. It still owns a page slot |
| Page index | Counts non-group rows only, mapping one-to-one to page_N containers |
| Collapsed | Children take no display slot; the parent row shows an expand chevron |
| Expanded | Children follow the parent row indented one level; clicking the parent again collapses them |
| Depth cap | NavigationTree.MAX_DEPTH = 3; deeper rows are not rendered (they stay in the model) |
| Orphans | A parent that names no existing row renders as a top-level row instead of vanishing |
| Self-reference / cycles | Cut automatically; recursion cannot loop |
| Hidden parent | Children still belong to it and collapse with it |
| Compact mode | The icon bar does not indent; NavigationViewItem hides its chevron in compact mode |
| Indicator | Sits on the row carrying the current page; when that page is inside a collapsed group it sits on the nearest displayed ancestor (the group header), as in WinUI |
| Toggle animation | Same rhythm as ComboBoxTree: displaced rows glide to their new slot, new rows appear in place and fade in after a short pause; the chevron turns with them. When a toggle hands the selection to another row (opening or closing the selected page's group), the indicator glides there on the same rhythm. The scroll-fade edges and the content height ease with the rows, so crossing the overflow threshold or collapsing while scrolled never jumps in one frame. The last group has no rows below it to glide, so its children skip the pause and the eased bottom edge wipes them in and out |
groupAnimationEnabled |
Public property, default true; with false a toggle jumps straight to the new layout: rows do not glide and new rows do not fade in |
| Bottom items | No grouping: QML / Python addGroup(..., "bottom") and C++ NavPosition::Bottom log a warning and are rejected, adding nothing (Python returns -1) |
NavigationBar / BottomTabBar |
No grouping: group headers are filtered out and page items are listed flat in page order |
Expansion state lives in the internal _expandedGroups property, keyed by group text, and can be driven with toggleGroup(modelIndex).
Why it works this way: the page stack's
countis exactlypageSources.length, andpageSources[index]is the page index. If a header occupied a model position but not a page, every later page would resolve to its neighbour. Letting headers "take a model row but no page slot", with one index conversion on each side, is the only shape that leaves existing page routing untouched.
SegmentedControl / Pivot¶
Both share the items model ({ key, text, icon } or plain strings) and currentIndex, and lay out horizontally by default:
Fluent.SegmentedControl {
items: ["General", "Appearance", "Advanced"]
onItemClicked: (index, byUser) => currentIndex = index
}
Fluent.Pivot {
items: [{ key: "docs", text: "Documents" }, { key: "img", text: "Images" }]
onItemClicked: (index, byUser) => currentIndex = index
}
orientation: Qt.Vertical stacks the cells and turns the bottom underline into a bar pinned to the left edge:
Fluent.SegmentedControl {
orientation: Qt.Vertical
items: ["General", "Appearance", "Advanced"]
onItemClicked: (index, byUser) => currentIndex = index
}
Vertical cells are sized to their content (they do not stretch), and the control is as wide as its widest cell. For a full-width vertical list use NavigationView or ToggleNavigationBar.
SelectorBar¶
A chrome-less selector: the strip sits directly on the page and only the selected cell
carries a sliding pill. It fits switching between a small set of views (2–5), reading
lighter than SegmentedControl and flatter than TabBar.
Fluent.SelectorBar {
items: [
{ key: "overview", text: "Overview" },
{ key: "activity", text: "Activity", icon: "History" },
{ key: "about", text: "About" }
]
onItemClicked: (index, byUser) => {
currentIndex = index
view.push(pages[index])
}
}
| Member | Meaning |
|---|---|
items: var |
{ key, text, icon } or plain strings |
currentIndex: int |
Selected index; an out-of-range value hides the pill instead of throwing |
orientation |
Qt.Horizontal (default) / Qt.Vertical; vertical stacks content-sized cells |
itemFontSize / iconSize |
Cell text and icon size |
pillAnimationEnabled |
Whether the pill slides; timing and curve match the tab switch (Enums.duration.slow + OutCubic). The initial placement never animates, every later selection does |
scrollDuration |
Programmatic pan duration, defaults to Enums.duration.scroll (same as TabBar / scroll areas) |
scrollable / maxScrollOffset / scrollOffset |
Read-only: horizontal overflow and the current scroll position |
itemClicked(index, byUser) |
User click request; it does not change currentIndex. Programmatic selection never emits it |
currentItemChanged(key) |
Selected key changed (any source, including programmatic and write-back) |
setCurrentIndex(idx) / setCurrentItem(key) |
Programmatic selection; out-of-range or unknown values are ignored |
addItem(key, text, icon) / getCurrentKey() |
Append an item / read the current key |
revealCurrent() |
Scroll the selected cell into view (also runs on selection change; minimal scroll, cell-boundary aligned) |
A horizontal strip scrolls when it does not fit: the selected cell is scrolled into view by the
smallest amount that fits it, preferring a cell boundary as the leading edge so the strip never
leaves a half-cut label behind. The wheel or a drag pans the strip. Programmatic movement (wheel,
auto-reveal) runs through the repository's shared smooth-scroll engine, so it glides rather than
teleports; scrollDuration tunes it. Wheel ownership matches TabBar — an overflowing strip
consumes the wheel itself, while a strip that fits never competes and lets the wheel reach the
page scroll area. A vertical strip does not scroll and is sized to its content.
TabBar / TabWidget¶
Horizontal (the default) supports drag reordering, scrolling, closing and an add button. TabBar renders the tabs only; page content belongs to the caller or to TabWidget.
orientation: Qt.Vertical moves the tab column to the leading edge, leaving the rest of the area to the pages:
Fluent.TabWidget {
orientation: Qt.Vertical
width: 360
height: 220
tabs: [ { title: "One", content: page1 }, { title: "Two", content: page2 } ]
}
Vertical behaviour: rows fill the column width and take the row height (tabWidth, when set, becomes the row height), long titles elide, the close button sits at the trailing edge, drag reordering runs along the column, the add button lands at the end of the column, and overflow scrolls on Y. The column width defaults to Enums.controlSize.tabBarVerticalWidth and can be overridden with the public stripWidth property (the horizontal counterpart is tabBarHeight; TabWidget proxies stripWidth too).
TabBar is controlled, TabWidget manages its own¶
TabBar is controlled: clicks and drag release only emit signals, and the host writes the selection back. After a drag the host first reorders tabs, then sets currentIndex to the drop position to:
Fluent.TabBar {
tabs: ["Alpha", "Bravo", "Charlie"]
movable: true
onTabClicked: (index) => currentIndex = index
onTabsReordered: (from, to) => {
var next = tabs.slice()
next.splice(to, 0, next.splice(from, 1)[0])
tabs = next
currentIndex = to
}
}
The controlled contract covers clicks and drags only. removeTab(index) and clear() change currentIndex themselves: after a removal leaves currentIndex past the last tab, removeTab clamps it to the last tab, and clear() always sets it to 0. These are imperative assignments, so they break an inline binding the host placed on currentIndex. When onTabClosed calls removeTab, sync the external state afterwards and restore the binding:
Fluent.TabBar {
currentIndex: appState.tab
closable: true
onTabClicked: (index) => appState.tab = index
onTabClosed: (index) => {
removeTab(index)
appState.tab = currentIndex // adopt the index the control adjusted
currentIndex = Qt.binding(() => appState.tab) // restore the inline binding
}
}
When a Binding element drives currentIndex instead, keep only the line that syncs the external state.
TabWidget is self-managing: its content area reads its own currentIndex, so it selects on click and drag itself and the host writes no handler. It manages only the selection: after a drag release the host still reorders tabs itself in onTabsReordered, and TabWidget then moves the selection to the drop position to. The cost is that its currentIndex cannot take an inline binding, because the first click breaks it. To follow external state, use a Binding element (wiring D under "Selection-index binding contract" below). Use TabBar directly when a fully controlled strip is required.
CommandPalette¶
A Ctrl+K style command surface: modal overlay + search field + ranked result list. Filtering, fuzzy matching, group headers, match highlighting and ↑↓ navigation are reused from the library's search stack (SearchResultList); this component owns only opening, the scrim, focus and command dispatch.
Fluent.CommandPalette {
id: palette
shortcut: "Ctrl+K" // optional global shortcut; empty disables it
placeholderText: "Type a command..."
hintText: "Up/Down navigate Enter run Esc close" // empty hides the footer
items: [
{ key: "open-file", title: "Open File", subtitle: "Ctrl+O",
section: "File", icon: Enums.iconPath + "FolderOpen.svg" },
{ key: "toggle-theme", title: "Toggle Theme", keywords: ["dark", "light"] }
]
onCommandTriggered: (key, item) => runCommand(key)
}
- Open:
open()/toggle(), or theshortcut. Every open clears the query and takes the keyboard into the search field. - Close:
Esc, a scrim click, orclose(). Running a command closes first and then emitsonCommandTriggered(key, item), so the host sees a settled state. - Data: each
itemsentry acceptskey / title / subtitle / icon / section / keywords / enabled; a non-emptysectionplussectionHeaders: truegroups the list. - Copy:
placeholderText/emptyText/hintTextare injected by the caller; nothing is hard-coded. - Key routing: while open, ↑ / ↓ / Enter / Esc are window-level shortcuts — the search field holds the focus and its inner text input swallows arrow keys before they can bubble to the panel.
Breadcrumb¶
Hierarchical path navigation. It is self-managing: clicking a level goes through setCurrentItem(), which writes currentIndex itself and trims the levels after it, so currentIndex cannot take an inline binding.
PipsPager¶
Supports paging buttons and visible-count limits. PipsPager, HorizontalPipsPager and VerticalPipsPager are all self-managing: clicking a pip or a paging button writes currentIndex itself (so does the wheel on HorizontalPipsPager / VerticalPipsPager), so currentIndex cannot take an inline binding.
Selection-index binding contract¶
Navigation controls fall into two classes, differing in who writes currentIndex on click.
The two classes¶
| Class | Controls | Click behaviour |
|---|---|---|
| Controlled | NavigationBar, NavigationView, ToggleNavigationBar, BottomTabBar, SegmentedControl, SelectorBar, Pivot, TabBar, FilterBar |
A click (and, for TabBar, a drag release) only emits request signals and does not write the index. The host must push it back |
| Self-managing | TabWidget, PipsPager (including HorizontalPipsPager / VerticalPipsPager), Breadcrumb |
A click writes currentIndex itself; the host writes nothing back |
The click and drag paths of controlled controls never make an imperative assignment to currentIndex, so currentIndex: externalState is safe and the binding survives a click. The guarantee covers user interaction only. Public methods the host calls still assign imperatively and break an inline binding the same way: setCurrentIndex() / setCurrentItem(), and TabBar's removeTab() / clear() (see "TabBar is controlled, TabWidget manages its own" above). With external state, change the state instead of calling these methods.
A click on a self-managing control assigns currentIndex imperatively, so an inline binding breaks on the first click. To follow external state, use a Binding element (wiring D, except for Breadcrumb), or leave currentIndex unbound and write the new value into the external state from the click or change signal.
FilterBar exposes two request signals: single-select listens to itemClicked(index), multi-select listens to selectionRequested(indices) carrying the toggled array. indexChanged / selectionChanged are state notifications and no longer fire directly from a click. indexChanged fires only when currentIndex takes a different value. selectionChanged fires every time a new array is assigned to selectedIndices, even when its content is identical (the payload is a normalized copy of the array).
The correct wiring¶
A. Standalone use with no external state — write the index back in the request handler:
Fluent.SegmentedControl {
items: [{ key: "a", text: "One" }, { key: "b", text: "Two" }]
onItemClicked: (index, byUser) => currentIndex = index
}
B. With external state — inline binding plus a state update in the request handler:
Fluent.SelectorBar {
currentIndex: appState.view
onItemClicked: (index, byUser) => appState.view = index
}
C. FilterBar multi-select — the host writes selectedIndices back:
Fluent.FilterBar {
exclusive: false
selectedIndices: appState.filters
onSelectionRequested: (indices) => appState.filters = indices
}
D. A self-managing control following external state — use a Binding element and sync the external state from the change signal:
Fluent.TabWidget {
id: tabs
tabs: [{ title: "One", content: page1 }, { title: "Two", content: page2 }]
onCurrentIndexChanged: appState.tab = currentIndex
}
Binding { target: tabs; property: "currentIndex"; value: appState.tab }
A Binding element stays in effect after the control writes currentIndex itself and writes the value again when the external state changes. PipsPager works the same way. Breadcrumb is the exception: writing its currentIndex directly does not trim the later levels, so do not bind that property. Write the new value into the external state from currentItemChanged(key), and call setCurrentItem() / setCurrentIndex() to navigate.
For controlled controls, inline bindings are now safe and a Binding element is no longer required. Existing Binding wiring still works and does not need changing.
History¶
Up to and including 0.8.1.0 these six controls (ToggleNavigationBar, SegmentedControl, SelectorBar, Pivot, TabBar, FilterBar) wrote their own index on click, which broke the caller's inline binding — typically surfacing as the ghost nav row left behind in WindowType.FILLED windows. Since 0.9.0.0 they are all controlled.
Migrating from 0.8.1.0¶
| Control | What to add where the control used to switch itself |
|---|---|
SegmentedControl / SelectorBar / Pivot |
onItemClicked: (index, byUser) => currentIndex = index |
TabBar |
onTabClicked: (index) => currentIndex = index; for drag also reorder in onTabsReordered, then currentIndex = to |
ToggleNavigationBar |
onItemClicked: (index) => currentIndex = index |
FilterBar single-select |
onItemClicked: (index) => currentIndex = index; indexChanged no longer fires on click |
FilterBar multi-select |
onSelectionRequested: (indices) => selectedIndices = indices; selectionChanged no longer fires on click |
TabWidget |
Nothing (self-managing; a click already broke an inline binding in 0.8.1.0) |
PipsPager / Breadcrumb |
Nothing (self-managing, behaviour unchanged) |
Besides the click semantics, one notification changed when it fires:
| Control | 0.8.1.0 | Now |
|---|---|---|
currentItemChanged(key) on SegmentedControl / SelectorBar / Pivot |
Emitted only from setCurrentIndex() (and setCurrentItem() plus the old click path, which called it) |
Emitted from onCurrentIndexChanged: any currentIndex change fires it (once the matching delegate exists), including host write-back and changes to an external binding |
Handlers that treated currentItemChanged as "the user switched" now also run when the bound value changes. To react to user actions only, listen to itemClicked(index, byUser) instead.
Existing Binding elements may stay: they are correct under both semantics, they are just no longer necessary.
Skin adaptation¶
Under neo: the selected nav item becomes a solid orange block + black border + white icon/text (replacing Fluent's light highlight + sliding indicator); the TabWidget's selected tab is white with a thick black border + hard shadow; pager dots are orange when selected, black otherwise.