FactCheckBox.qml 781 Bytes
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3 4 5 6 7 8 9 10
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QGroundControl.FactSystem 1.0

CheckBox {
    property Fact fact: Fact { value: 0 }
    property variant checkedValue: 1
    property variant uncheckedValue: 0

11 12
    property var __qgcpal: QGCPalette { colorGroup: QGCPalette.Active }

Don Gagne's avatar
Don Gagne committed
13 14 15 16 17 18 19 20 21 22 23
    partiallyCheckedEnabled: fact.value != checkedValue && fact.value != uncheckedValue
    checkedState: fact.value == checkedValue ? Qt.Checked : (fact.value == uncheckedValue ? Qt.Unchecked : Qt.PartiallyChecked)

    text: "Label"

    onClicked: {
        fact.value = checked ? checkedValue : uncheckedValue
    }

    style: CheckBoxStyle {
        label: Text {
24
            color: __qgcpal.windowText
Don Gagne's avatar
Don Gagne committed
25 26 27 28
            text: control.text
        }
    }
}