summaryrefslogtreecommitdiffstats
path: root/framework/qml/Switch.qml
blob: ad24054c2744ee710887db423d678964e0a4f0f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import QtQuick 2.8
import QtQuick.Templates 2.2 as T
import org.kube.framework 1.0 as Kube


T.Switch {
    id: root

    implicitWidth: indicator.width
    implicitHeight: indicator.height

    indicator: Item {
        height: Kube.Units.gridUnit
        width: Kube.Units.gridUnit * 2

        Rectangle {
            width: parent.width
            height: parent.height
            color: root.checked ? Kube.Colors.highlightColor : Kube.Colors.buttonColor
            radius: 2
        }

        Rectangle {
            height: parent.height
            width: height
            x: root.visualPosition * Kube.Units.gridUnit
            radius: 2
            color: Kube.Colors.viewBackgroundColor
            border.width: 1
            border.color: Kube.Colors.buttonColor
        }
    }
}