QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ToolIndicatorPage.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6
7// ToolIndicatorPage
8// The base control for all Toolbar Indicator drop down pages. It supports a normal and expanded view.
9
10RowLayout {
11 id: control
12 spacing: ScreenTools.defaultFontPixelWidth
13
14 property bool showExpand: false // Controls whether the expand widget is shown or not
15 property bool waitForParameters: false // UI won't show until parameters are ready
16 property bool expandedComponentWaitForParameters: false // If true, the expanded component won't show until parameters are ready
17 property Component contentComponent // Item for the normal view portion of the page
18 property Component expandedComponent // Item for the expanded portion of the page
19 property var pageProperties // Allows you to share a QtObject full of properties between pages
20
21 // These properties are bound by the MainRoowWindow loader
22 property bool expanded: false
23 property var drawer
24
25 property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
26 property bool parametersReady: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable
27
28 property bool _showMainComponent: !waitForParameters || parametersReady
29 property bool _showExpand: showExpand && expandedComponent !== undefined
30 property bool _expandedParametersReady: !expandedComponentWaitForParameters || parametersReady
31 property string _waitingForParamsText: activeVehicle && activeVehicle.parameterManager.parameterDownloadSkipped ? qsTr("Parameters not available") : qsTr("Waiting for parameters...")
32
33 QGCLabel {
34 text: control._waitingForParamsText
35 visible: waitForParameters && !parametersReady
36 }
37
38 Loader {
39 id: contentItemLoader
40 Layout.alignment: Qt.AlignTop
41 sourceComponent: _showMainComponent ? contentComponent : undefined
42
43 property var pageProperties: control.pageProperties
44 }
45
46 Rectangle {
47 id: divider
48 Layout.preferredWidth: visible ? 1 : -1
49 Layout.fillHeight: true
50 color: QGroundControl.globalPalette.groupBorder
51 visible: expanded
52 }
53
54 QGCLabel {
55 text: activeVehicle && activeVehicle.parameterManager.parameterDownloadSkipped ? qsTr("Parameters not available") : qsTr("Waiting for parameters...")
56 visible: expanded && !_expandedParametersReady
57 Layout.alignment: Qt.AlignTop
58 }
59
60 Loader {
61 id: expandedItemLoader
62 Layout.alignment: Qt.AlignTop
63 Layout.preferredWidth: visible ? -1 : 0
64 visible: expanded && _expandedParametersReady
65 sourceComponent: expanded && _expandedParametersReady ? expandedComponent : undefined
66
67 property var pageProperties: control.pageProperties
68 }
69}