From 7324a46761145fcb57324324f72f71c75a1b0596 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 22 Jul 2021 18:38:18 +0200 Subject: [PATCH] fix switches --- qml-ui/components/Controller.qml | 13 +++++++------ qtquick-controls-style/Zynthian-Plasma/Switch.qml | 1 + .../Zynthian-Plasma/SwitchIndicator.qml | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/qml-ui/components/Controller.qml b/qml-ui/components/Controller.qml index 125fe2b88..9ad907f92 100644 --- a/qml-ui/components/Controller.qml +++ b/qml-ui/components/Controller.qml @@ -136,6 +136,12 @@ Card { scale: root.valueType === "bool" enabled: root.valueType === "bool" onClicked: root.controller.value = root.controller.value == root.controller.value0 ? root.controller.max_value : root.controller.value0 + Behavior on scale { + NumberAnimation { + duration: Kirigami.Units.longDuration + easing.type: Easing.InOutQuad + } + } QQC2.Switch { id: switchControl anchors.centerIn: parent @@ -150,12 +156,7 @@ Card { property: "color" value: switchControl.checked ? Kirigami.Theme.highlightColor : switchControl.palette.midlight }*/ - Behavior on scale { - NumberAnimation { - duration: Kirigami.Units.longDuration - easing.type: Easing.InOutQuad - } - } + Kirigami.Heading { anchors { horizontalCenter: parent.horizontalCenter diff --git a/qtquick-controls-style/Zynthian-Plasma/Switch.qml b/qtquick-controls-style/Zynthian-Plasma/Switch.qml index 8fa0f3f22..05843f756 100644 --- a/qtquick-controls-style/Zynthian-Plasma/Switch.qml +++ b/qtquick-controls-style/Zynthian-Plasma/Switch.qml @@ -24,6 +24,7 @@ T.Switch { hoverEnabled: true indicator: SwitchIndicator { + control: control LayoutMirroring.enabled: control.mirrored LayoutMirroring.childrenInherit: true anchors { diff --git a/qtquick-controls-style/Zynthian-Plasma/SwitchIndicator.qml b/qtquick-controls-style/Zynthian-Plasma/SwitchIndicator.qml index 98374b16b..2b1a1ebd4 100644 --- a/qtquick-controls-style/Zynthian-Plasma/SwitchIndicator.qml +++ b/qtquick-controls-style/Zynthian-Plasma/SwitchIndicator.qml @@ -10,6 +10,7 @@ import "private" as Private import org.kde.kirigami 2.4 as Kirigami Item { + id: root property Item control implicitWidth: Math.round(Kirigami.Units.gridUnit * 1.5) implicitHeight : Kirigami.Units.gridUnit @@ -21,7 +22,7 @@ Item { radius: height Kirigami.Theme.inherit: false Kirigami.Theme.colorSet: Kirigami.Theme.Button - color: switchControl.checked ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor + color: control.checked ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor border.color: Qt.rgba(Kirigami.Theme.textColor.r, Kirigami.Theme.textColor.g, Kirigami.Theme.textColor.b, 0.4) }