diff options
-rw-r--r-- | framework/qml/Switch.qml | 35 | ||||
-rw-r--r-- | framework/qmldir | 1 |
2 files changed, 36 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 | } | ||
diff --git a/framework/qmldir b/framework/qmldir index 461bd653..691dbba8 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -21,6 +21,7 @@ ProgressBar 1.0 ProgressBar.qml | |||
21 | StatusBar 1.0 StatusBar.qml | 21 | StatusBar 1.0 StatusBar.qml |
22 | ComboBox 1.0 ComboBox.qml | 22 | ComboBox 1.0 ComboBox.qml |
23 | CheckBox 1.0 CheckBox.qml | 23 | CheckBox 1.0 CheckBox.qml |
24 | Switch 1.0 as Switch.qml | ||
24 | PositiveButton 1.0 PositiveButton.qml | 25 | PositiveButton 1.0 PositiveButton.qml |
25 | TextButton 1.0 TextButton.qml | 26 | TextButton 1.0 TextButton.qml |
26 | TextField 1.0 TextField.qml | 27 | TextField 1.0 TextField.qml |