diff options
Diffstat (limited to 'framework/qml/Switch.qml')
-rw-r--r-- | framework/qml/Switch.qml | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/framework/qml/Switch.qml b/framework/qml/Switch.qml new file mode 100644 index 00000000..2803c84a --- /dev/null +++ b/framework/qml/Switch.qml | |||
@@ -0,0 +1,35 @@ | |||
1 | import QtQuick 2.8 | ||
2 | import QtQuick.Templates 2.2 as T | ||
3 | import org.kube.framework 1.0 as Kube | ||
4 | |||
5 | |||
6 | T.Switch { | ||
7 | id: root | ||
8 | |||
9 | implicitWidth: indicator.width | ||
10 | implicitHeight: indicator.height | ||
11 | |||
12 | indicator: Item { | ||
13 | height: Kube.Units.gridUnit | ||
14 | width: Kube.Units.gridUnit * 2 | ||
15 | |||
16 | Rectangle { | ||
17 | width: parent.width | ||
18 | height: parent.height | ||
19 | radius: 5 | ||
20 | color: root.checked ? Kube.Colors.highlightColor : Kube.Colors.buttonColor | ||
21 | } | ||
22 | |||
23 | Rectangle { | ||
24 | height: parent.height | ||
25 | width: height | ||
26 | |||
27 | x: root.visualPosition * Kube.Units.gridUnit | ||
28 | |||
29 | radius: 5 | ||
30 | color: Kube.Colors.viewBackgroundColor | ||
31 | border.width: 1 | ||
32 | border.color: Kube.Colors.buttonColor | ||
33 | } | ||
34 | } | ||
35 | } | ||