QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FlightModeMenuIndicator.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
9RowLayout {
10 id: _root
11 spacing: 0
12
13 property bool showIndicator: true
14
15 property real fontPointSize: ScreenTools.largeFontPointSize
16 property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
17
18 property var _editFieldWidth: ScreenTools.defaultFontPixelWidth * 13
19 property Fact _mpcLandSpeedFact: controller.getParameterFact(-1, "MPC_LAND_SPEED", false)
20 property Fact _precisionLandingFact: controller.getParameterFact(-1, "RTL_PLD_MD", false)
21
22 FactPanelController { id: controller }
23
24 RowLayout {
25 id: rowLayout
26 spacing: 0
27 height: parent.height
28
29 QGCColoredImage {
30 id: flightModeIcon
31 width: ScreenTools.defaultFontPixelWidth * 2
32 height: ScreenTools.defaultFontPixelHeight * 0.75
33 fillMode: Image.PreserveAspectFit
34 mipmap: true
35 color: qgcPal.text
36 source: "/qmlimages/FlightModesComponentIcon.png"
37 Layout.alignment: Qt.AlignVCenter
38 }
39
40 Item {
41 Layout.preferredWidth: ScreenTools.defaultFontPixelWidth / 2
42 height: 1
43 }
44
45 QGCLabel {
46 text: activeVehicle ? activeVehicle.flightMode : qsTr("N/A", "No data to display")
47 font.pointSize: fontPointSize
48 Layout.alignment: Qt.AlignCenter
49
50 MouseArea {
51 anchors.fill: parent
52 onClicked: indicatorDrawer.open()
53 }
54 }
55 }
56
57 Drawer {
58 id: indicatorDrawer
59 y: ScreenTools.toolbarHeight
60 width: mainLayout.width + (ScreenTools.defaultFontPixelWidth * 2)
61 height: mainWindow.height - y
62 visible: false
63 modal: true
64 focus: true
65 dragMargin: 0
66 closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
67
68 background: Rectangle {
69 color: QGroundControl.globalPalette.window
70 opacity: 0.75
71 }
72
73 Row {
74 id: mainLayout
75 anchors.margins: ScreenTools.defaultFontPixelWidth
76 anchors.top: parent.top
77 anchors.left: parent.left
78 anchors.bottom: parent.bottom
79 spacing: ScreenTools.defaultFontPixelWidth * 2
80
81 // Mode list
82 QGCFlickable {
83 anchors.top: parent.top
84 anchors.bottom: parent.bottom
85 width: modeColumn.width
86 contentHeight: modeColumn.height
87
88 ColumnLayout {
89 id: modeColumn
90 spacing: ScreenTools.defaultFontPixelWidth / 2
91
92 Repeater {
93 model: activeVehicle ? activeVehicle.flightModes : []
94
95 QGCButton {
96 text: modelData
97 Layout.fillWidth: true
98
99 onClicked: {
100 activeVehicle.flightMode = text
101 indicatorDrawer.close()
102 }
103 }
104 }
105 }
106 }
107
108 // Settings
109 ColumnLayout {
110 width: ScreenTools.defaultFontPixelWidth * 50
111 spacing: ScreenTools.defaultFontPixelWidth / 2
112
113 RowLayout {
114 Layout.fillWidth: true
115
116 QGCLabel { Layout.fillWidth: true; text: qsTr("RTL Altitude") }
117 FactTextField {
118 fact: controller.getParameterFact(-1, "RTL_RETURN_ALT")
119 Layout.minimumWidth: _editFieldWidth
120 }
121 }
122
123 RowLayout {
124 Layout.fillWidth: true
125 visible: _mpcLandSpeedFact && controller.vehicle && !controller.vehicle.fixedWing
126
127 QGCLabel { Layout.fillWidth: true; text: qsTr("Land Descent Rate:") }
128 FactTextField {
129 fact: _mpcLandSpeedFact
130 Layout.minimumWidth: _editFieldWidth
131 }
132 }
133
134 RowLayout {
135 Layout.fillWidth: true
136 visible: _precisionLandingFact
137
138 QGCLabel { Layout.fillWidth: true; text: qsTr("Precision Landing") }
139 FactComboBox {
140 fact: _precisionLandingFact
141 indexModel: false
142 sizeToContents: true
143 }
144 }
145 }
146 }
147 }
148}