123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import QtQuick 1.0
- Row {
- id: checkBox
- property bool checked: false
- property alias text: txtCheckBox.text
- property alias font: txtCheckBox.font
- function setCheck( checked ) {
- checkBox.checked = checked
- }
- state: checked == true ? "check" : "uncheck"
- spacing: 20
- states: [
- State {
- name: "check"
- PropertyChanges { target: imgCheckDefault; source: "qrc:/qml/images/bar_ok.png" }
- },
- State {
- name: "uncheck"
- PropertyChanges { target: imgCheckDefault; source: "qrc:/qml/images/bar_blank.png" }
- }
- ]
- Image {
- id: imgCheckDefault
- anchors.verticalCenter: parent.verticalCenter
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if( checkBox.state == "check" ) {
- checkBox.state = "uncheck"
- checked = false
- } else {
- checkBox.state = "check"
- checked = true
- }
- }
- }
- }
- Text {
- id: txtCheckBox
- anchors.verticalCenter: parent.verticalCenter
- text: ""
- font.pixelSize: 28
- }
- } //checkBoxDefault
|