Fact Controls¶
Import: import QGroundControl.FactControls
Fact controls are UI components that bind directly to Fact objects. They automatically display the fact's value, units, enum options, and validation -- reducing boilerplate when building parameter editing or telemetry display UIs.
FactTextField¶
A text field bound to a Fact. Shows the fact's value and units, validates input on editing.
Key Properties¶
| Property | Type | Description |
|---|---|---|
fact |
Fact |
The fact to bind to |
showUnits |
bool |
Show units label |
Example¶
import QGroundControl.FactControls
FactTextField {
fact: vehicle.fetchParameter("MPC_XY_VEL_MAX")
showUnits: true
}
FactComboBox¶
A combo box bound to a Fact with enum values. Automatically populates options from the fact's enum strings.
Key Properties¶
| Property | Type | Description |
|---|---|---|
fact |
Fact |
The fact to bind to |
indexModel |
bool |
Use index-based model |
Example¶
FactCheckBox¶
A checkbox bound to a boolean Fact.
Key Properties¶
| Property | Type | Description |
|---|---|---|
fact |
Fact |
The fact to bind to |
checkedValue |
int |
Value that means "checked" (default: 1) |
uncheckedValue |
int |
Value that means "unchecked" (default: 0) |
Example¶
FactLabel¶
A read-only label that displays a fact's value string.
Key Properties¶
| Property | Type | Description |
|---|---|---|
fact |
Fact |
The fact to display |
Example¶
import QGroundControl.FactControls
Row {
QGCLabel { text: "Max speed:" }
FactLabel { fact: vehicle.fetchParameter("MPC_XY_VEL_MAX") }
}
FactSlider / RangedFactSlider¶
Sliders bound to a Fact, respecting its min/max bounds.
Key Properties¶
| Property | Type | Description |
|---|---|---|
fact |
Fact |
The fact to bind to |
Example¶
import QGroundControl.FactControls
RangedFactSlider {
fact: vehicle.fetchParameter("MPC_XY_VEL_MAX")
}
When to use Fact Controls¶
Use Fact Controls when you are building UI that edits or displays vehicle parameters:
import QGroundControl.FactControls
GridLayout {
columns: 2
QGCLabel { text: "Max Speed" }
FactTextField {
fact: vehicle.fetchParameter("MPC_XY_VEL_MAX")
showUnits: true
}
QGCLabel { text: "Fail-safe Action" }
FactComboBox {
fact: vehicle.fetchParameter("NAV_RCL_ACT")
}
}
For displaying telemetry values (which are read-only), you can also bind directly to the fact's properties without Fact Controls: