panel title bar: add title, action buttons slot, divider; bt to popup mode; move wifi/bt toggles to title bar

This commit is contained in:
Damocles 2026-04-16 18:51:06 +02:00
parent 46f14d5d36
commit d4407ee538
7 changed files with 128 additions and 184 deletions

View file

@ -32,6 +32,7 @@ PanelWindow {
// Shared
required property color accentColor
property string panelTitle: ""
property Component titleActionsComponent: null
property string panelNamespace: "nova-panel"
property real contentWidth: 220
@ -231,9 +232,10 @@ PanelWindow {
id: _panelColumn
width: root.contentWidth
// Header row: title (optional) + pin button hover mode only
// Header row: title + action buttons + pin shown in hover mode always,
// and in popup mode when a title or actions are provided.
Item {
visible: !root.popupMode
visible: !root.popupMode || root.panelTitle !== "" || root.titleActionsComponent !== null
width: parent.width
height: 24
@ -249,13 +251,24 @@ PanelWindow {
font.family: M.Theme.fontFamily
}
Item {
visible: root.panelHovered || root._pinned
anchors.right: parent.right
// Action buttons anchored left of pin button slot
Loader {
id: _titleActionsLoader
anchors.right: _pinBtn.left
anchors.rightMargin: 4
anchors.verticalCenter: parent.verticalCenter
width: 20
sourceComponent: root.titleActionsComponent
}
// Pin button zero-width in popup mode so actions anchor flush to right
Item {
id: _pinBtn
anchors.right: parent.right
anchors.rightMargin: root.popupMode ? 0 : 4
anchors.verticalCenter: parent.verticalCenter
width: root.popupMode ? 0 : 20
height: 20
visible: !root.popupMode && (root.panelHovered || root._pinned)
opacity: pinHover.hovered || root._pinned ? 1 : 0.35
Behavior on opacity {
@ -291,6 +304,15 @@ PanelWindow {
}
}
}
// Divider at bottom of header
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 1
color: M.Theme.base03
}
}
Column {