QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PX4CollisionComponent.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6import QGroundControl.FactControls
7
8import "PX4CollisionRows.js" as CollisionRows
9import "PX4ConfigRows.js" as ConfigRows
10
11SetupPage {
12 id: collisionPage
13 pageComponent: pageComponent
14
15 // Parameter values when the page first showed them, so a reboot is only flagged after a change
16 property var _initialValues: Object.create(null)
17
18 readonly property var _vehicle: controller.vehicle
19 readonly property var _overlayFact: QGroundControl.settingsManager.flyViewSettings.showObstacleDistanceOverlay
20 readonly property var _rows: ConfigRows.visibleRows(
21 CollisionRows.collisionRows(),
22 {
23 "multiRotor": _vehicle ? _vehicle.multiRotor : false,
24 "fixedWing": _vehicle ? _vehicle.fixedWing : false,
25 "vtol": _vehicle ? _vehicle.vtol : false
26 },
27 function (name) { return controller.parameterExists(-1, name) })
28 readonly property var _groups: ConfigRows.groupRows(_rows)
29
30 function _fact(name) {
31 return controller.getParameterFact(-1, name, false)
32 }
33
34 function _rowActive(row) {
35 return ConfigRows.isRowActive(row, function (name) {
36 const fact = _fact(name)
37 return fact ? fact.rawValue : undefined
38 })
39 }
40
41 FactPanelController {
42 id: controller
43 // Reboot-required settings are marked on the page instead
44 suppressRebootMessage: true
45 }
46
47 Component {
48 id: pageComponent
49
50 ColumnLayout {
51 width: Math.max(availableWidth, implicitWidth)
52 spacing: _margins
53
54 ConfigRowsPanel {
55 ConfigRowGroups {
56 model: _groups
57 objectNamePrefix: "collision"
58
59 rowDelegate: ConfigRow {
60 id: rowLayout
61 objectName: "collision_row_" + row.id
62 title: row.title
63 params: row.params
64 active: _rowActive(row)
65 showSeparator: index > 0
66
67 required property var modelData
68 required property int index
69
70 readonly property var row: modelData
71
72 ConfigNote {
73 text: rowLayout.row.description
74 }
75
76 cellsData: Repeater {
77 model: rowLayout.row.cells
78
79 ConfigParamCell {
80 cell: modelData
81 factFor: collisionPage._fact
82 initialValues: collisionPage._initialValues
83 objectNamePrefix: "collision"
84
85 required property var modelData
86 }
87 }
88 }
89 }
90
91 ColumnLayout {
92 Layout.fillWidth: true
93 spacing: ScreenTools.defaultFontPixelHeight * 0.5
94
95 ConfigGroupHeader {
96 text: qsTr("Display")
97 }
98
99 ConfigRow {
100 objectName: "collision_row_overlay"
101 title: qsTr("Obstacle overlay")
102 active: collisionPage._overlayFact.rawValue > 0
103
104 ConfigNote {
105 text: qsTr("Draws the distances measured around the vehicle on the fly view.")
106 }
107
108 cellsData: QGCCaptionCell {
109 caption: qsTr("Show obstacle distance overlay")
110
111 FactCheckBoxSlider {
112 objectName: "collision_setting_showObstacleDistanceOverlay"
113 fact: collisionPage._overlayFact
114 }
115 }
116 }
117 }
118 }
119 }
120 }
121}