QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FactBitMaskCheckBoxSlider.qml
Go to the documentation of this file.
1import QtQuick
2
3import QGroundControl
4import QGroundControl.Controls
5
6/// Toggle slider bound to a single bit within a Fact's bitmask rawValue.
7/// The slider stays in sync with the Fact and sets/clears the specified bit on click.
8///
9/// Example:
10/// FactBitMaskCheckBoxSlider {
11/// text: qsTr("Continue in Auto mode")
12/// fact: _fsOptions
13/// bitMask: 2 // bit 1
14/// }
15QGCCheckBoxSlider {
16 id: control
17
18 property Fact fact: Fact { }
19 property int bitMask: 0
20
21 checked: fact && (fact.rawValue & bitMask)
22
23 Connections {
24 target: fact
25 function onRawValueChanged() { control.checked = fact.rawValue & control.bitMask }
26 }
27
28 onClicked: {
29 if (checked) {
30 fact.rawValue |= bitMask
31 } else {
32 fact.rawValue &= ~bitMask
33 }
34 }
35}