Newer
Older
import QtQuick 2.3
import QtQuick.Controls 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
/// true: Checking the first entry will clear and disable all other entries
property bool firstEntryIsAll: false
Component.onCompleted: {
if (firstEntryIsAll && repeater.itemAt(0).checked) {
for (var i=1; i<repeater.count; i++) {
var otherCheckbox = repeater.itemAt(i)
otherCheckbox.enabled = false
}
}
}
model: fact ? fact.bitmaskStrings : []
text: modelData
checked: fact.value & fact.bitmaskValues[index]
onClicked: {
if (firstEntryIsAll && index == 0) {
for (i = 1; i < repeater.count; i++) {
otherCheckbox = repeater.itemAt(i)
fact.value &= ~fact.bitmaskValues[i]
otherCheckbox.checked = false
otherCheckbox.enabled = false
}
}
if (firstEntryIsAll && index == 0) {
for (i = 1; i < repeater.count; i++) {
otherCheckbox = repeater.itemAt(i)
otherCheckbox.enabled = true
}
}