QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
EditPositionDialog.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
8import QGroundControl.FactControls
9
10QGCPopupDialog {
11 id: root
12 title: qsTr("Edit Position")
13 buttons: Dialog.Close
14
15 property alias coordinate: controller.coordinate
16 property bool showSetPositionFromVehicle: true
17
18 property real _margin: ScreenTools.defaultFontPixelWidth / 2
19 property real _textFieldWidth: ScreenTools.defaultFontPixelWidth * 20
20 property bool _showGeographic: coordinateSystemCombo.comboBox.currentIndex === 0
21 property bool _showUTM: coordinateSystemCombo.comboBox.currentIndex === 1
22 property bool _showMGRS: coordinateSystemCombo.comboBox.currentIndex === 2
23 property bool _showVehicle: coordinateSystemCombo.comboBox.currentIndex === 3
24
25 EditPositionDialogController {
26 id: controller
27
28 Component.onCompleted: initValues()
29 }
30
31 ColumnLayout {
32 spacing: _margin
33
34 LabelledComboBox {
35 id: coordinateSystemCombo
36 Layout.fillWidth: true
37 label: qsTr("Coordinate System")
38 model: showSetPositionFromVehicle && globals.activeVehicle ?
39 [ qsTr("Geographic"), qsTr("Universal Transverse Mercator"), qsTr("Military Grid Reference"), qsTr("Vehicle Position") ] :
40 [ qsTr("Geographic"), qsTr("Universal Transverse Mercator"), qsTr("Military Grid Reference") ]
41 }
42
43 LabelledFactTextField {
44 label: qsTr("Latitude")
45 fact: controller.latitude
46 textFieldPreferredWidth: _textFieldWidth
47 Layout.fillWidth: true
48 visible: _showGeographic
49 }
50
51 LabelledFactTextField {
52 label: qsTr("Longitude")
53 fact: controller.longitude
54 textFieldPreferredWidth: _textFieldWidth
55 Layout.fillWidth: true
56 visible: _showGeographic
57 }
58
59 LabelledButton {
60 label: qsTr("Set position")
61 buttonText: qsTr("Move")
62 visible: _showGeographic
63 onClicked: {
64 controller.setFromGeo()
65 root.close()
66 }
67 }
68
69 LabelledFactTextField {
70 label: qsTr("Zone")
71 fact: controller.zone
72 textFieldPreferredWidth: _textFieldWidth
73 Layout.fillWidth: true
74 visible: _showUTM
75 }
76
77 LabelledFactComboBox {
78 label: qsTr("Hemisphere")
79 fact: controller.hemisphere
80 indexModel: false
81 Layout.fillWidth: true
82 visible: _showUTM
83 }
84
85 LabelledFactTextField {
86 label: qsTr("Easting")
87 fact: controller.easting
88 textFieldPreferredWidth: _textFieldWidth
89 Layout.fillWidth: true
90 visible: _showUTM
91 }
92
93 LabelledFactTextField {
94 label: qsTr("Northing")
95 fact: controller.northing
96 textFieldPreferredWidth: _textFieldWidth
97 Layout.fillWidth: true
98 visible: _showUTM
99 }
100
101 LabelledButton {
102 label: qsTr("Set position")
103 buttonText: qsTr("Move")
104 visible: _showUTM
105 onClicked: {
106 controller.setFromUTM()
107 root.close()
108 }
109 }
110
111 LabelledFactTextField {
112 label: qsTr("MGRS")
113 fact: controller.mgrs
114 visible: _showMGRS
115 textFieldPreferredWidth: _textFieldWidth
116 Layout.fillWidth: true
117 }
118
119 LabelledButton {
120 label: qsTr("Set position")
121 buttonText: qsTr("Move")
122 visible: _showMGRS
123 onClicked: {
124 controller.setFromMGRS()
125 root.close()
126 }
127 }
128
129 LabelledButton {
130 label: qsTr("Set position")
131 buttonText: qsTr("Move")
132 visible: _showVehicle
133 onClicked: {
134 controller.setFromVehicle()
135 root.close()
136 }
137 }
138 }
139}