LVRS Document Viewer
components/navigation/Hierarchy.svx
Path: components/navigation/Hierarchy.svx
Hierarchy
Location: qml/components/navigation/Hierarchy.qml
Hierarchy is a tree-panel surface composed of toolbar + scrollable hierarchy list.
Purpose
- Render nested model data with explicit expand/collapse controls.
- Provide activation and expansion callbacks for host features.
- Keep tree navigation usable inside nested scroll containers.
API
Required inputs:
- Toolbar declaration:
toolbarItems(array model) ortoolbarButtons(manualToolbarButtonchildren) - List model binding:
model/treeModel
Model and selection aliases:
model/treeModelactiveListItemactiveListItemIdactiveListItemKey
Toolbar aliases:
toolbarButtonstoolbarItemsactiveToolbarButtonactiveToolbarButtonIdactiveToolbarIndex
Behavior aliases:
autoExpandDepthkeyboardListNavigationEnabled
Optional footer:
footerVisiblefooterInteractivefooterButton1footerButton2footerButton3
Methods:
expandAll()collapseAll(keepRootExpanded)activateListItemById(itemId)activateListItemByKey(itemKey)triggerFooterButton(index)
Signals:
toolbarActivated(button, buttonId, index)toolbarButtonTriggered(button, buttonId, index, item)toolbarEventTriggered(eventName, payload, index, item, buttonId)listItemActivated(item, itemId, index)listItemExpanded(item, itemId, index, expanded)footerButtonTriggered(index, config)
Usage
import LVRS 1.0 as LV
LV.Hierarchy {
toolbarItems: [
{ id: "structure", iconName: "projectStructure", eventName: "hierarchy.structure" },
{ id: "layers", iconName: "projectStructure", events: ["hierarchy.layers", "analytics.layers"] }
]
model: [
{
key: "root",
label: "Root",
expanded: true,
children: [{ key: "child", label: "Child" }]
}
]
footerVisible: true
footerButton1: ({ type: "icon", iconName: "projectStructure" })
footerButton2: ({ type: "icon", iconName: "delete" })
footerButton3: ({ type: "menu", iconName: "viewMoreSymbolicDefault" })
}
How It Works
- Toolbar and list communicate through explicit signals and forwarded aliases.
ensureListItemVisibleadjusts flickable viewport when list requests visibility.WheelScrollGuardis installed to prevent nested scroll bleed.- Optional
ListFooteris anchored bottom-left; when visible, list viewport ends at footer top.
Advanced Usage: Programmatic Activation
import LVRS 1.0 as LV
LV.Hierarchy {
id: tree
}
function focusNodeByKey(key) {
tree.activateListItemByKey(key)
}
Operational Notes
- Keep item ids/keys stable for reliable programmatic activation.
- Combine
expandAll()withactivate*()in onboarding flows to reveal deep nodes deterministically.
Failure Pattern
Using non-unique keys for sibling nodes breaks programmatic activation and expansion tracking. Assign stable unique identifiers for each logical node.