summaryrefslogtreecommitdiff
path: root/components/custom/CheckBox.qml
blob: 5a1a86967e312324c202829239acafff2c93d64d (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
import QtQuick 2.0
import "./behaviors"

Item {
    id: checkBox

    signal clicked
    property alias pressed: behavior.pressed
    property alias checked: behavior.checked
    property alias containsMouse: behavior.containsMouse
    property bool activeFocusOnPress: false
    property Component background: null
    property Item backgroundItem: backgroundLoader.item

    // implementation

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

    ButtonBehavior {
        id: behavior
        anchors.fill: parent
        checkable: true
        onClicked: {if (activeFocusOnPress)checkBox.focus = true; checkBox.clicked()}
    }

    SystemPalette { id: syspal }
}