aboutsummaryrefslogtreecommitdiff
path: root/components/CheckBox.qml
blob: 9cfe38b302f2e5b724e4341d850402537a7597ba (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import QtQuick 2.0

Item {
    id: checkBox
    property alias text: label.text
    property bool checked: false
    signal clicked()
    height: 25
    width: label.x + label.width
    clip: true

    Rectangle {
        anchors.left: parent.left
        height: parent.height - 1
        width: 25
        //radius: 4
        y: 0
        color: "#DBDBDB"
    }

    Rectangle {
        anchors.left: parent.left
        height: parent.height - 1
        width: 25
        //radius: 4
        y: 1
        color: "#FFFFFF"

        Image {
            anchors.centerIn: parent
            source: checkBox.checked ? "../images/checkedIcon.png" :
                                       "../images/uncheckedIcon.png"
        }
    }

    Text {
        id: label
        anchors.verticalCenter: parent.verticalCenter
        anchors.left: parent.left
        anchors.leftMargin: 25 + 12
        font.family: "Arial"
        font.pixelSize: 14
        font.letterSpacing: -1
        color: "#525252"
    }

    MouseArea {
        anchors.fill: parent
        onClicked: {
            checkBox.checked = !checkBox.checked
            checkBox.clicked()
        }
    }
}