extra sizing conditions for sys tray

This commit is contained in:
kossLAN 2025-06-09 18:37:40 -04:00
parent 3c79cc5213
commit d2149e0705
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8
6 changed files with 147 additions and 73 deletions

View file

@ -49,6 +49,9 @@ RowLayout {
id: trayMenu
visible: false
property var leftItem: false
property var rightItem: false
ColumnLayout {
id: menuContainer
spacing: 2
@ -56,11 +59,13 @@ RowLayout {
Repeater {
model: menuOpener.children
delegate: TrayMenu {
delegate: TrayMenuItem {
id: sysTrayContent
Layout.fillWidth: true
Layout.fillHeight: true
rootMenu: trayMenu
onInteracted: {
root.popup.hide();
menuOpener.menu = null;

View file

@ -9,8 +9,19 @@ import "../.."
ColumnLayout {
id: root
required property QsMenuEntry menuData
required property var rootMenu
signal interacted
Component.onCompleted: {
if (menuData?.buttonType !== QsMenuButtonType.None || menuData?.icon != "") {
rootMenu.leftItem = true;
}
if (!menuData?.hasChildren) {
rootMenu.rightItem = false;
}
}
WrapperRectangle {
Layout.fillWidth: true
Layout.preferredHeight: 25
@ -48,6 +59,7 @@ ColumnLayout {
Layout.fillWidth: true
Item {
visible: root.rootMenu.leftItem
Layout.preferredWidth: 20
Layout.fillHeight: true
Layout.alignment: Qt.AlignVCenter
@ -96,13 +108,14 @@ ColumnLayout {
}
Item {
visible: root.rootMenu.rightItem
Layout.preferredHeight: 20
Layout.preferredWidth: 20
Layout.rightMargin: 5
Widgets.IconButton {
id: arrowButton
visible: root.menuData?.hasChildren
visible: root.menuData?.hasChildren ?? false
activeRectangle: false
source: "root:resources/general/right-arrow.svg"
rotation: subTrayMenu.visible ? 90 : 0
@ -146,9 +159,10 @@ ColumnLayout {
delegate: BoundComponent {
id: subMenuEntry
source: "TrayMenu.qml"
source: "TrayMenuItem.qml"
Layout.fillWidth: true
required property var modelData
property var rootMenu: root.rootMenu
}
}
}

View file

@ -6,6 +6,8 @@ import "../.."
ColumnLayout {
id: root
required property QsMenuEntry modelData
required property var rootMenu
property var leftItem
signal interacted
Rectangle {
@ -19,6 +21,7 @@ ColumnLayout {
TrayMenuEntry {
visible: !root.modelData?.isSeparator
rootMenu: root.rootMenu
menuData: root.modelData
Layout.fillWidth: true
onInteracted: root.interacted()