FactCheckBox.qml 642 Bytes
Newer Older
Don Gagne's avatar
Don Gagne committed
1 2 3
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
4

Don Gagne's avatar
Don Gagne committed
5
import QGroundControl.FactSystem 1.0
6
import QGroundControl.Palette 1.0
7
import QGroundControl.Controls 1.0
Don Gagne's avatar
Don Gagne committed
8

9
QGCCheckBox {
10
    property Fact fact: Fact { }
Don Gagne's avatar
Don Gagne committed
11 12 13 14 15 16
    property variant checkedValue: 1
    property variant uncheckedValue: 0

    partiallyCheckedEnabled: fact.value != checkedValue && fact.value != uncheckedValue
    checkedState: fact.value == checkedValue ? Qt.Checked : (fact.value == uncheckedValue ? Qt.Unchecked : Qt.PartiallyChecked)

17
    text: qsTr("Label")
Don Gagne's avatar
Don Gagne committed
18 19 20 21 22

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