QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PX4FlightModeIndicator.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.Controls
7import QGroundControl.FactControls
8
9ColumnLayout {
10 Layout.preferredWidth: ScreenTools.defaultFontPixelWidth * 60
11 spacing: margins / 2
12
13 property Fact mpcLandSpeedFact: controller.getParameterFact(-1, "MPC_LAND_SPEED", false)
14 property Fact precisionLandingFact: controller.getParameterFact(-1, "RTL_PLD_MD", false)
15 property Fact sys_vehicle_resp: controller.getParameterFact(-1, "SYS_VEHICLE_RESP", false)
16 property Fact mpc_xy_vel_all: controller.getParameterFact(-1, "MPC_XY_VEL_ALL", false)
17 property Fact mpc_z_vel_all: controller.getParameterFact(-1, "MPC_Z_VEL_ALL", false)
18 property var qgcPal: QGroundControl.globalPalette
19 property real margins: ScreenTools.defaultFontPixelHeight
20 property real sliderWidth: ScreenTools.defaultFontPixelWidth * 40
21 property var flyViewSettings: QGroundControl.settingsManager.flyViewSettings
22
23 FactPanelController { id: controller }
24
25 SettingsGroupLayout {
26 Layout.fillWidth: true
27
28 FactSlider {
29 Layout.fillWidth: true
30 Layout.preferredWidth: sliderWidth
31 label: qsTr("RTL Altitude")
32 fact: controller.getParameterFact(-1, "RTL_RETURN_ALT")
33 to: fact.maxIsDefaultForType ? QGroundControl.unitsConversion.metersToAppSettingsVerticalDistanceUnits(121.92) : fact.max
34 majorTickStepSize: 10
35 }
36 }
37
38 SettingsGroupLayout {
39 Layout.fillWidth: true
40 heading: qsTr("GeoFence")
41
42 LabelledFactComboBox {
43 Layout.fillWidth: true
44 label: qsTr("Breach Action")
45 fact: controller.getParameterFact(-1, "GF_ACTION")
46 }
47
48 ColumnLayout {
49 QGCCheckBoxSlider {
50 Layout.fillWidth: true
51 text: qsTr("Max Distance")
52 checked: maxDistanceSlider.value > 0
53
54 onClicked: {
55 if (checked) {
56 maxDistanceSlider.setValue(prevValue != 0 ? prevValue : maxDistanceSlider.to)
57 } else {
58 prevValue = maxDistanceSlider.value
59 maxDistanceSlider.setValue(0)
60 }
61 }
62
63 property real prevValue: 0
64 }
65
66 FactSlider {
67 id: maxDistanceSlider
68 Layout.fillWidth: true
69 fact: controller.getParameterFact(-1, "GF_MAX_HOR_DIST")
70 to: flyViewSettings.maxGoToLocationDistance.value
71 majorTickStepSize: 500
72 enabled: fact.value > 0
73 }
74 }
75
76 ColumnLayout {
77 QGCCheckBoxSlider {
78 Layout.fillWidth: true
79 text: qsTr("Max Altitude")
80 checked: maxAltitudeSlider.value > 0
81
82 onClicked: {
83 if (checked) {
84 maxAltitudeSlider.setValue(prevValue != 0 ? prevValue : maxAltitudeSlider.to)
85 } else {
86 prevValue = maxAltitudeSlider.value
87 maxAltitudeSlider.setValue(0)
88 }
89 }
90
91 property real prevValue: 0
92 }
93
94 FactSlider {
95 id: maxAltitudeSlider
96 Layout.fillWidth: true
97 fact: controller.getParameterFact(-1, "GF_MAX_VER_DIST")
98 to: flyViewSettings.guidedMaximumAltitude.value
99 majorTickStepSize: 10
100 enabled: fact.value > 0
101 }
102 }
103 }
104}