diff options
Diffstat (limited to 'components/custom/CheckBox.qml')
-rw-r--r-- | components/custom/CheckBox.qml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/components/custom/CheckBox.qml b/components/custom/CheckBox.qml new file mode 100644 index 00000000..e8b86556 --- /dev/null +++ b/components/custom/CheckBox.qml @@ -0,0 +1,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 } +} |