Skip to content

Commit

Permalink
fix switches
Browse files Browse the repository at this point in the history
  • Loading branch information
notmart committed Jul 22, 2021
1 parent 1254f4f commit 7324a46
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
13 changes: 7 additions & 6 deletions qml-ui/components/Controller.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions qtquick-controls-style/Zynthian-Plasma/Switch.qml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ T.Switch {
hoverEnabled: true

indicator: SwitchIndicator {
control: control
LayoutMirroring.enabled: control.mirrored
LayoutMirroring.childrenInherit: true
anchors {
Expand Down
3 changes: 2 additions & 1 deletion qtquick-controls-style/Zynthian-Plasma/SwitchIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}

Expand Down

0 comments on commit 7324a46

Please sign in to comment.