summaryrefslogtreecommitdiff
path: root/src/components/CheckBox.qml
blob: e8b865564964a523353c8860d4fa3a6ca4ded71f (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
import QtQuick 1.1
import "./behaviors"
import "./styles/default" as DefaultStyles

Item {
    id: checkBox

    signal clicked
    property alias pressed: behavior.pressed
    property alias checked: behavior.checked
    property alias containsMouse: behavior.containsMouse

    property Component background: defaultStyle.background
    property Component checkmark: defaultStyle.checkmark

    property color backgroundColor: syspal.base

    property int minimumWidth: defaultStyle.minimumWidth
    property int minimumHeight: defaultStyle.minimumHeight

    // implementation

    implicitWidth: minimumWidth
    implicitHeight: minimumHeight

    Loader {
        id: backgroundLoader
        anchors.fill: parent
        property alias styledItem: checkBox
        sourceComponent: background
    }

    Loader {
        id: checkmarkLoader
        anchors.centerIn: parent
        property alias styledItem: checkBox
        sourceComponent: checkmark
    }

    ButtonBehavior {
        id: behavior
        anchors.fill: parent
        checkable: true
        onClicked: checkBox.clicked()
    }

    DefaultStyles.CheckBoxStyle { id: defaultStyle }
    SystemPalette { id: syspal }
}