QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
RallyPointItemEditor.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
9Rectangle {
10 id: root
11 height: _currentItem ? valuesRect.y + valuesRect.height + (_margin * 2) : titleBar.y - titleBar.height + _margin
12 color: _currentItem ? qgcPal.buttonHighlight : qgcPal.windowShade
13 radius: _radius
14
15 signal clicked()
16
17 property var rallyPoint ///< RallyPoint object associated with editor
18 property var controller ///< RallyPointController
19
20 property bool _currentItem: rallyPoint ? rallyPoint === controller.currentRallyPoint : false
21 property color _outerTextColor: qgcPal.text // _currentItem ? "black" : qgcPal.text
22
23 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
24 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
25 readonly property real _titleHeight: ScreenTools.defaultFontPixelHeight * 2
26
27 QGCPalette { id: qgcPal; colorGroupEnabled: true }
28
29 Item {
30 id: titleBar
31 anchors.margins: _margin
32 anchors.top: parent.top
33 anchors.left: parent.left
34 anchors.right: parent.right
35 height: _titleHeight
36
37 MissionItemIndexLabel {
38 id: indicator
39 anchors.verticalCenter: parent.verticalCenter
40 anchors.left: parent.left
41 label: "R"
42 checked: true
43 }
44
45 QGCLabel {
46 anchors.leftMargin: _margin
47 anchors.left: indicator.right
48 anchors.verticalCenter: parent.verticalCenter
49 text: qsTr("Rally Point")
50 color: _outerTextColor
51 }
52
53 QGCColoredImage {
54 id: hamburger
55 anchors.rightMargin: _margin
56 anchors.right: parent.right
57 anchors.verticalCenter: parent.verticalCenter
58 width: ScreenTools.defaultFontPixelWidth * 2
59 height: width
60 sourceSize.height: height
61 source: "qrc:/qmlimages/Hamburger.svg"
62 color: qgcPal.text
63
64 MouseArea {
65 anchors.fill: parent
66 onClicked: hamburgerMenu.popup()
67
68 QGCMenu {
69 id: hamburgerMenu
70
71 QGCMenuItem {
72 text: qsTr("Delete")
73 onTriggered: controller.removePoint(rallyPoint)
74 }
75 }
76 }
77 }
78 } // Item - titleBar
79
80 Rectangle {
81 id: valuesRect
82 anchors.margins: _margin
83 anchors.left: parent.left
84 anchors.right: parent.right
85 anchors.top: titleBar.bottom
86 height: valuesGrid.height + (_margin * 2)
87 color: qgcPal.windowShadeDark
88 visible: _currentItem
89 radius: _radius
90
91 GridLayout {
92 id: valuesGrid
93 anchors.margins: _margin
94 anchors.left: parent.left
95 anchors.right: parent.right
96 anchors.top: parent.top
97 rowSpacing: _margin
98 columnSpacing: _margin
99 rows: rallyPoint ? rallyPoint.textFieldFacts.length : 0
100 flow: GridLayout.TopToBottom
101
102 Repeater {
103 model: rallyPoint ? rallyPoint.textFieldFacts : 0
104 QGCLabel {
105 text: modelData.name + ":"
106 }
107 }
108
109 Repeater {
110 model: rallyPoint ? rallyPoint.textFieldFacts : 0
111 FactTextField {
112 Layout.fillWidth: true
113 showUnits: true
114 fact: modelData
115 }
116 }
117 } // GridLayout
118 } // Rectangle
119} // Rectangle