From e9d4fd84829661b1b26a0d9316e072e460f3a4cf Mon Sep 17 00:00:00 2001 From: Cyril Anisimov Date: Sun, 10 Aug 2025 05:13:58 +0200 Subject: [PATCH] fix checkbox switch (#1777) --- client/ui/qml/Controls2/CheckBoxType.qml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/ui/qml/Controls2/CheckBoxType.qml b/client/ui/qml/Controls2/CheckBoxType.qml index 451fe01d5..4c72a0d11 100644 --- a/client/ui/qml/Controls2/CheckBoxType.qml +++ b/client/ui/qml/Controls2/CheckBoxType.qml @@ -173,15 +173,17 @@ CheckBox { enabled: false } + Keys.onEnterPressed: event => handleSwitch(event) + Keys.onReturnPressed: event => handleSwitch(event) + Keys.onSpacePressed: event => handleSwitch(event) - Keys.onEnterPressed: { - root.checked = !root.checked + function handleSwitch(event) { + if (!event.isAutoRepeat) { + root.checked = !root.checked + root.checkedChanged() + } + event.accepted = true } - - Keys.onReturnPressed: { - root.checked = !root.checked - } - }