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 + _innerMargin : titleLayout.y + titleLayout.height + _margin
12 color: _currentItem ? qgcPal.buttonHighlight : qgcPal.windowShade
13 radius: _radius
14
15 property var rallyPoint ///< RallyPoint object associated with editor
16 property var controller ///< RallyPointController
17
18 property bool _currentItem: rallyPoint ? rallyPoint === controller.currentRallyPoint : false
19 property color _outerTextColor: qgcPal.text
20
21 readonly property real _margin: ScreenTools.defaultFontPixelWidth / 2
22 readonly property real _innerMargin: 2
23 readonly property real _radius: ScreenTools.defaultFontPixelWidth / 2
24 readonly property real _titleHeight: ScreenTools.implicitComboBoxHeight + ScreenTools.defaultFontPixelWidth
25
26 QGCPalette { id: qgcPal; colorGroupEnabled: true }
27
28 RowLayout {
29 id: titleLayout
30 anchors.margins: _margin
31 anchors.left: parent.left
32 anchors.rightMargin: _margin * 2
33 anchors.right: parent.right
34 height: _titleHeight
35 spacing: ScreenTools.defaultFontPixelWidth
36
37 QGCLabel {
38 text: qsTr("Rally Point")
39 color: _outerTextColor
40 }
41
42 QGCColoredImage {
43 id: deleteButton
44 Layout.alignment: Qt.AlignRight
45 Layout.preferredWidth: ScreenTools.defaultFontPixelHeight * 0.5
46 Layout.preferredHeight: Layout.preferredWidth
47 source: "/res/XDelete.svg"
48 color: _outerTextColor
49 }
50 }
51
52 QGCMouseArea {
53 id: selectMouseArea
54 anchors.top: titleLayout.top
55 anchors.bottomMargin: -_margin
56 anchors.bottom: titleLayout.bottom
57 anchors.left: titleLayout.left
58 anchors.right: titleLayout.right
59 onClicked: {
60 if (mainWindow.allowViewSwitch()) {
61 controller.currentRallyPoint = rallyPoint
62 }
63 }
64 }
65
66 QGCMouseArea {
67 anchors.top: selectMouseArea.top
68 anchors.bottom: selectMouseArea.bottom
69 anchors.right: selectMouseArea.right
70 width: height
71 onClicked: {
72 if (mainWindow.allowViewSwitch()) {
73 controller.removePoint(rallyPoint)
74 }
75 }
76 }
77
78 Rectangle {
79 id: valuesRect
80 anchors.margins: _innerMargin
81 anchors.left: parent.left
82 anchors.right: parent.right
83 anchors.top: titleLayout.bottom
84 height: valuesLayout.height + (_margin * 2)
85 color: qgcPal.windowShadeDark
86 visible: _currentItem
87 radius: _radius
88
89 ColumnLayout {
90 id: valuesLayout
91 anchors.margins: _margin
92 anchors.left: parent.left
93 anchors.right: parent.right
94 anchors.top: parent.top
95 spacing: _margin
96
97 Repeater {
98 model: rallyPoint ? rallyPoint.textFieldFacts : 0
99
100 LabelledFactTextField {
101 Layout.fillWidth: true
102 label: modelData.shortDescription
103 fact: modelData
104 }
105 }
106 }
107 }
108}