diff options
author | Marvin Borner | 2020-04-03 18:34:39 +0200 |
---|---|---|
committer | Marvin Borner | 2020-04-03 22:08:27 +0200 |
commit | 922b65b3eaeb975224adcdfda8a2595cd76309d5 (patch) | |
tree | 9d9a1b89503d4f985c6d675e307b4027c19d1ede /qml/Bit.qml | |
parent | 53ad9a4e95dab0b9cd56b829eac4062a5c46e560 (diff) |
Well, I'm back at SFOS development!
This unfinished idea shows a dynamic approach to the binary fun game
including dynamic bit lengths - that's awesome, isn't it?
Aside from this AWESOME new feature, I removed the logic and the ugly
code from before and need to rewrite it ASAP :)
Diffstat (limited to 'qml/Bit.qml')
-rw-r--r-- | qml/Bit.qml | 31 |
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 +} |