aboutsummaryrefslogtreecommitdiffhomepage
path: root/qml/Bit.qml
diff options
context:
space:
mode:
Diffstat (limited to 'qml/Bit.qml')
-rw-r--r--qml/Bit.qml31
1 files changed, 31 insertions, 0 deletions
diff --git a/qml/Bit.qml b/qml/Bit.qml
new file mode 100644
index 0000000..3e7dd7b
--- /dev/null
+++ b/qml/Bit.qml
@@ -0,0 +1,31 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+
+Loader {
+ property int index: 0
+ property int bits: 0
+
+ Component {
+ id: bit
+ Switch {
+ width: Theme.paddingLarge * 2
+ height: width
+ onClicked: root.check(index)
+ }
+ }
+
+ Component {
+ id: bit_index
+ Label {
+ text: parent.index.toString()
+ width: Theme.paddingLarge * 2
+ height: width
+ horizontalAlignment: TextInput.AlignHCenter
+ verticalAlignment: TextInput.AlignVCenter
+ Component.onCompleted: this.text = "0"
+ }
+ }
+
+ sourceComponent: (index % (bits + 1) == bits)
+ || (index <= bits) ? bit_index : bit
+}