summaryrefslogtreecommitdiffstats
path: root/framework/qml/Switch.qml
blob: 2803c84ac5d6dfb6d7b2defbd8bdd2307c36b820 (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
34
35
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
            radius: 5
            color: root.checked ? Kube.Colors.highlightColor : Kube.Colors.buttonColor
        }

        Rectangle {
            height: parent.height
            width: height

            x: root.visualPosition * Kube.Units.gridUnit

            radius: 5
            color: Kube.Colors.viewBackgroundColor
            border.width: 1
            border.color: Kube.Colors.buttonColor
        }
    }
}