QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
APMFlightModeIndicator.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
9SettingsGroupLayout {
10 Layout.fillWidth: true
11 heading: qsTr("Return to Launch")
12 visible: activeVehicle.multiRotor
13
14 property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
15 property Fact rtlAltFact: controller.getParameterFact(-1, "RTL_ALT")
16
17 FactPanelController { id: controller }
18
19 RowLayout {
20 Layout.fillWidth: true
21 spacing: ScreenTools.defaultFontPixelWidth * 2
22
23 QGCLabel {
24 id: label
25 Layout.fillWidth: true
26 text: qsTr("Return At")
27 }
28
29 QGCComboBox {
30 id: returnAtCombo
31 sizeToContents: true
32 model: [ qsTr("Current altitude"), qsTr("Specified altitude") ]
33
34 function setCurrentIndex() {
35 if (rtlAltFact.value === 0) {
36 returnAtCombo.currentIndex = 0
37 } else {
38 returnAtCombo.currentIndex = 1
39 }
40 }
41
42 Component.onCompleted: setCurrentIndex()
43
44 onActivated: (index) => {
45 if (index === 0) {
46 rtlAltFact.rawValue = 0
47 } else {
48 rtlAltFact.rawValue = 1500
49 }
50 }
51
52 Connections {
53 target: rtlAltFact
54 onRawValueChanged: returnAtCombo.setCurrentIndex()
55 }
56 }
57
58 FactTextField {
59 fact: rtlAltFact
60 enabled: rtlAltFact.rawValue !== 0
61 }
62 }
63}