From 2ca1d1fb9390d8b8f7395f6f4c69d53988d9a4a9 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 20 Aug 2018 10:57:47 +0200 Subject: Toggle checkbox with return. toggle() doesn't reliably work for some reason, so we use the checked state instead. --- framework/qml/CheckBox.qml | 4 +++- views/calendar/qml/View.qml | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/framework/qml/CheckBox.qml b/framework/qml/CheckBox.qml index ce4df209..e0655887 100644 --- a/framework/qml/CheckBox.qml +++ b/framework/qml/CheckBox.qml @@ -26,7 +26,9 @@ T.CheckBox { implicitWidth: indicator.width implicitHeight: indicator.width - Keys.onReturnPressed: root.toggle() + Keys.onReturnPressed: { + root.checked = !root.checked + } indicator: Rectangle { width: Kube.Units.gridUnit diff --git a/views/calendar/qml/View.qml b/views/calendar/qml/View.qml index fe88b084..065faecb 100644 --- a/views/calendar/qml/View.qml +++ b/views/calendar/qml/View.qml @@ -17,7 +17,7 @@ */ import QtQuick 2.9 -import QtQuick.Controls 2.1 +import QtQuick.Controls 2 import QtQuick.Layouts 1.2 import org.kube.framework 1.0 as Kube @@ -156,7 +156,9 @@ RowLayout { id: checkBox opacity: 0.9 checked: !model.checked - onToggled: model.checked = !checked + onCheckedChanged: { + model.checked = !checked + } indicator: Rectangle { width: Kube.Units.gridUnit -- cgit v1.2.3