QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FenceItemList.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6
7/// List of the fences and the breach return point of the GeoFence tab
8QGCListView {
9 id: root
10
11 required property var page
12
13 signal itemActivated
14
15 objectName: "planPanel_fenceList"
16 model: page.entries
17 spacing: ScreenTools.defaultFontPixelHeight * 0.1
18 clip: true
19
20 delegate: PlanPanelRow {
21 id: row
22
23 required property var modelData
24
25 readonly property var fence: root.page.objectFor(modelData.kind, modelData.index)
26
27 objectName: "planPanel_fenceRow_" + modelData.key
28 width: root.width
29 selected: modelData.key === root.page.selectedKey
30
31 onClicked: {
32 root.page.selectEntry(modelData)
33 root.itemActivated()
34 }
35
36 QGCColoredImage {
37 Layout.preferredHeight: ScreenTools.defaultFontPixelHeight
38 Layout.preferredWidth: Layout.preferredHeight
39 source: row.modelData.kind === "breach" ? "/res/waypoint.svg" : "/res/GeoFence.svg"
40 color: qgcPal.textPrimary
41 fillMode: Image.PreserveAspectFit
42 sourceSize.height: height
43 }
44
45 QGCLabel {
46 Layout.fillWidth: true
47 elide: Text.ElideRight
48 text: {
49 switch (row.modelData.kind) {
50 case "polygon":
51 return qsTr("Polygon %1").arg(row.modelData.index + 1)
52 case "circle":
53 return qsTr("Circle %1").arg(row.modelData.index + 1)
54 }
55 return qsTr("Breach return point")
56 }
57 }
58
59 QGCLabel {
60 objectName: "planPanel_fenceRowMeta"
61 color: qgcPal.textSecondary
62 font.pointSize: ScreenTools.smallFontPointSize
63 text: {
64 if (row.modelData.kind === "breach") {
65 return root.page.controller.breachReturnPoint.isValid ? qsTr("Set") : qsTr("Not set")
66 }
67 if (!row.fence) {
68 return ""
69 }
70 const inclusion = row.fence.inclusion ? qsTr("Include") : qsTr("Exclude")
71 if (row.modelData.kind === "circle") {
72 return qsTr("%1 %2, %3").arg(row.fence.radius.valueString).arg(row.fence.radius.units).arg(inclusion)
73 }
74 return inclusion
75 }
76 }
77 }
78
79 QGCPalette { id: qgcPal }
80}