tray: work around qt compiled binding bug on visible via indirection

This commit is contained in:
Damocles 2026-04-26 15:17:27 +02:00
parent dde0b73ca5
commit 35f880b563

View file

@ -10,27 +10,28 @@ import "../services" as S
M.BarModule { M.BarModule {
id: root id: root
spacing: S.Theme.moduleSpacing + 2 spacing: S.Theme.moduleSpacing + 2
visible: S.Modules.tray.enable && _trayRepeater.count > 0
cursorShape: Qt.ArrowCursor cursorShape: Qt.ArrowCursor
// Workaround: Qt 6 compiled bindings break on `visible` when the expression
// references Repeater.count on a Row-derived component. The binding silently
// dies (imperative overwrite by the engine) and never re-evaluates. Routing
// through a custom property forces the interpreted binding path, which works.
property bool _shouldBeVisible: S.Modules.tray.enable && _trayRepeater.count > 0
visible: _shouldBeVisible
required property var bar required property var bar
property var _activeMenu: null property var _activeMenu: null
// Shadow binding to test if QML dependency tracking works on a fresh property // --- debug logging (remove once tray is confirmed working) ---
property bool _shouldBeVisible: S.Modules.tray.enable && _trayRepeater.count > 0
on_ShouldBeVisibleChanged: console.log("[TrayModule] _shouldBeVisible:", _shouldBeVisible, "actual visible:", visible) on_ShouldBeVisibleChanged: console.log("[TrayModule] _shouldBeVisible:", _shouldBeVisible, "actual visible:", visible)
Component.onCompleted: console.log("[TrayModule] created, enable:", S.Modules.tray.enable, "repeater count:", _trayRepeater.count) Component.onCompleted: console.log("[TrayModule] created, enable:", S.Modules.tray.enable, "repeater count:", _trayRepeater.count)
onVisibleChanged: console.log("[TrayModule] visible:", visible, "enable:", S.Modules.tray.enable, "count:", _trayRepeater.count) onVisibleChanged: console.log("[TrayModule] visible:", visible, "enable:", S.Modules.tray.enable, "count:", _trayRepeater.count)
Connections { Connections {
target: _trayRepeater target: _trayRepeater
function onCountChanged() { function onCountChanged() {
console.log("[TrayModule] repeater count:", _trayRepeater.count, "visible:", root.visible, "shouldBe:", S.Modules.tray.enable && _trayRepeater.count > 0); console.log("[TrayModule] repeater count:", _trayRepeater.count, "visible:", root.visible, "shouldBe:", S.Modules.tray.enable && _trayRepeater.count > 0);
} }
} }
Connections { Connections {
target: SystemTray.items target: SystemTray.items
function onValuesChanged() { function onValuesChanged() {