bar/systray: issue recreate on interact

This commit is contained in:
kossLAN 2025-06-08 18:52:36 -04:00
parent e81df16f49
commit f041f1d10f
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8
3 changed files with 20 additions and 7 deletions

View file

@ -29,11 +29,10 @@ RowLayout {
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
// trayText.width = sysTrayContent.width - trayIcon.width - trayContainer.spacing; menuOpener.menu = trayField.modelData.menu;
// trayText.visible = true;
// root.popup.set(this, trayMenu);
if (root.popup.content == trayMenu) { if (root.popup.content == trayMenu) {
root.popup.toggle() root.popup.hide();
return; return;
} }
@ -44,7 +43,6 @@ RowLayout {
QsMenuOpener { QsMenuOpener {
id: menuOpener id: menuOpener
menu: trayField.modelData.menu
} }
WrapperItem { WrapperItem {
@ -62,6 +60,7 @@ RowLayout {
id: sysTrayContent id: sysTrayContent
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
onInteracted: menuOpener.menu = null
} }
} }
} }

View file

@ -6,6 +6,7 @@ import "../.."
ColumnLayout { ColumnLayout {
id: root id: root
required property QsMenuEntry modelData required property QsMenuEntry modelData
signal interacted
Rectangle { Rectangle {
visible: (root.modelData?.isSeparator ?? false) visible: (root.modelData?.isSeparator ?? false)
@ -20,5 +21,6 @@ ColumnLayout {
visible: !root.modelData?.isSeparator visible: !root.modelData?.isSeparator
menuData: root.modelData menuData: root.modelData
Layout.fillWidth: true Layout.fillWidth: true
onInteracted: root.interacted()
} }
} }

View file

@ -8,6 +8,7 @@ import "../.."
ColumnLayout { ColumnLayout {
id: root id: root
required property var menuData required property var menuData
signal interacted
WrapperRectangle { WrapperRectangle {
Layout.fillWidth: true Layout.fillWidth: true
@ -31,10 +32,13 @@ ColumnLayout {
if (!root.menuData?.enabled) if (!root.menuData?.enabled)
return; return;
if (root.menuData?.hasChildren) if (root.menuData?.hasChildren) {
subTrayMenu.visible = !subTrayMenu.visible; subTrayMenu.visible = !subTrayMenu.visible;
return;
}
root.menuData?.triggered(); root.menuData?.triggered();
root.interacted();
} }
RowLayout { RowLayout {
@ -72,7 +76,7 @@ ColumnLayout {
Text { Text {
id: text id: text
text: (root.menuData?.text) ?? "" text: root.menuData?.text ?? ""
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: { color: {
let color = Qt.color(ShellSettings.settings.colors["inverse_surface"]); let color = Qt.color(ShellSettings.settings.colors["inverse_surface"]);
@ -88,6 +92,14 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Connections {
target: root.menuData
function onTextChanged() {
console.log("Hi");
}
}
} }
Item { Item {