aboutsummaryrefslogtreecommitdiffhomepage
path: root/qml/Bit.qml
blob: 3e7dd7b168c68e3da66dd8c1244577926e17acf3 (plain) (blame)
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
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
}