QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MissionItemRow.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6
7/// One row of the mission item list
8Rectangle {
9 id: root
10
11 required property var object ///< VisualMissionItem
12
13 signal clicked
14
15 readonly property bool _ready: object.readyForSaveState === VisualMissionItem.ReadyForSave
16 readonly property bool _current: object.isCurrentItem
17 readonly property real _badgeSize: ScreenTools.defaultFontPixelHeight * 1.5
18
19 objectName: "planPanel_missionRow_" + object.sequenceNumber
20 implicitHeight: Math.max(ScreenTools.defaultFontPixelHeight * 2.2, ScreenTools.isMobile ? ScreenTools.minTouchPixels : 0)
21 radius: ScreenTools.defaultBorderRadius
22 color: _current ? qgcPal.accentSubtle : "transparent"
23 border.width: _current ? 1 : 0
24 border.color: qgcPal.accent
25
26 QGCPalette { id: qgcPal }
27
28 RowLayout {
29 anchors.fill: parent
30 anchors.leftMargin: ScreenTools.defaultFontPixelWidth
31 anchors.rightMargin: ScreenTools.defaultFontPixelWidth
32 spacing: ScreenTools.defaultFontPixelWidth
33
34 Rectangle {
35 objectName: "planPanel_missionRowIndex_" + root.object.sequenceNumber
36 Layout.preferredWidth: root._badgeSize
37 Layout.preferredHeight: root._badgeSize
38 radius: width / 2
39 color: root._current ? qgcPal.accent : "transparent"
40 border.width: 2
41 border.color: root._ready ? (root._current ? qgcPal.accent : qgcPal.textPrimary) : qgcPal.warningText
42
43 property string text: root._ready ? (root.object.homePosition ? "H" : String(root.object.sequenceNumber)) : "?"
44
45 QGCLabel {
46 anchors.centerIn: parent
47 text: parent.text
48 font.pointSize: ScreenTools.smallFontPointSize
49 font.bold: true
50 color: root._current ? qgcPal.accentText : (root._ready ? qgcPal.textPrimary : qgcPal.warningText)
51 }
52 }
53
54 QGCLabel {
55 Layout.fillWidth: true
56 text: root.object.commandName
57 elide: Text.ElideRight
58 }
59
60 QGCLabel {
61 objectName: "planPanel_missionRowMeta"
62 text: root._meta()
63 color: root._ready ? qgcPal.textSecondary : qgcPal.warningText
64 font.pointSize: ScreenTools.smallFontPointSize
65 visible: text !== ""
66 }
67 }
68
69 function _meta() {
70 if (!_ready) {
71 return qsTr("Incomplete")
72 }
73 if (object.isSimpleItem && object.specifiesAltitude) {
74 return object.altitude.valueString + " " + object.altitude.units
75 }
76 return ""
77 }
78
79 MouseArea {
80 anchors.fill: parent
81 onClicked: root.clicked()
82 }
83}