QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MissionCommandDialog.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4import QtQuick.Dialogs
5
6import QGroundControl
7import QGroundControl.Controls
8
9QGCPopupDialog {
10 id: root
11 title: qsTr("Select Mission Command")
12 buttons: Dialog.Cancel
13
14 property var vehicle
15 property var missionItem
16 property var map
17 property bool flyThroughCommandsAllowed
18
19 ColumnLayout {
20 RowLayout {
21 spacing: ScreenTools.defaultFontPixelWidth
22
23 QGCLabel {
24 text: qsTr("Category:")
25 }
26
27 QGCComboBox {
28 id: categoryCombo
29 Layout.preferredWidth: 30 * ScreenTools.defaultFontPixelWidth
30 model: QGroundControl.missionCommandTree.categoriesForVehicle(vehicle)
31
32 function categorySelected(category) {
33 commandList.model = QGroundControl.missionCommandTree.getCommandsForCategory(vehicle, category, flyThroughCommandsAllowed)
34 }
35
36 Component.onCompleted: {
37 var category = missionItem.category
38 currentIndex = find(category)
39 categorySelected(category)
40 }
41
42 onActivated: (index) => { categorySelected(textAt(index)) }
43 }
44 }
45
46 Repeater {
47 id: commandList
48 Layout.fillWidth: true
49
50 delegate: Rectangle {
51 width: parent.width
52 height: commandColumn.height + ScreenTools.defaultFontPixelHeight
53 color: QGroundControl.globalPalette.button
54
55 property var mavCmdInfo: modelData
56 property color textColor: QGroundControl.globalPalette.buttonText
57
58 Column {
59 id: commandColumn
60 anchors.margins: ScreenTools.defaultFontPixelWidth
61 anchors.left: parent.left
62 anchors.right: parent.right
63 anchors.top: parent.top
64
65 QGCLabel {
66 text: mavCmdInfo.friendlyName
67 color: textColor
68 font.bold: true
69 }
70
71 QGCLabel {
72 anchors.margins: ScreenTools.defaultFontPixelWidth
73 anchors.left: parent.left
74 anchors.right: parent.right
75 text: mavCmdInfo.description
76 wrapMode: Text.WordWrap
77 color: textColor
78 }
79 }
80
81 MouseArea {
82 anchors.fill: parent
83 onClicked: {
84 missionItem.setMapCenterHintForCommandChange(map.center)
85 missionItem.command = mavCmdInfo.command
86 root.close()
87 }
88 }
89 }
90 }
91 }
92}