From 77952289f8176703eef7134262c6fd6d0d835dd6 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 21 Oct 2026 10:23:05 +0200 Subject: Switch: never set checked itself, report the new state instead The shared Switch flipped its own checked on click, which replaced the caller's binding with a constant. Every use binds checked, so after a click the switch stopped following its source: Discard on a settings draft reverted the value and left the switch showing the click. Four status rows and the headphones panel each carried a resync workaround for it. toggled now carries the new state and the switch moves only when the caller's binding does. Handlers that read checked as the new value take the argument instead; the workarounds are gone. Co-Authored-By: Claude Opus 5.5 --- desktop/island/HeadphonesPanel.qml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'desktop/island') diff --git a/desktop/island/HeadphonesPanel.qml b/desktop/island/HeadphonesPanel.qml index 86e3ae4..315bc6b 100644 --- a/desktop/island/HeadphonesPanel.qml +++ b/desktop/island/HeadphonesPanel.qml @@ -306,12 +306,7 @@ Column { anchors { right: parent.right; verticalCenter: parent.verticalCenter } enabled: !panel.busy checked: panel.voice - // The click flips checked itself, which breaks the binding; - // restore it so the switch follows what the headphones report. - onToggled: { - panel.run(["voice", checked ? "on" : "off"]); - checked = Qt.binding(() => panel.voice); - } + onToggled: on => panel.run(["voice", on ? "on" : "off"]) } } -- cgit v1.2.3