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 fillWindow: false // Drawer fills the window below the toolbar
16 property bool waitForParameters: false // UI won't show until parameters are ready
17 property bool expandedComponentWaitForParameters: false // If true, the expanded component won't show until parameters are ready
18 property Component contentComponent // Item for the normal view portion of the page
19 property Component expandedComponent // Item for the expanded portion of the page
20 property var pageProperties // Allows you to share a QtObject full of properties between pages
21
22 // These properties are bound by the MainRoowWindow loader
23 property bool expanded: false
24 property var drawer
25
26 property var activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
27 property bool parametersReady: QGroundControl.multiVehicleManager.parameterReadyVehicleAvailable
28
29 property bool _showMainComponent: !waitForParameters || parametersReady
30 property bool _showExpand: showExpand && expandedComponent !== undefined
31 property bool _expandedParametersReady: !expandedComponentWaitForParameters || parametersReady
32 property string _waitingForParamsText: activeVehicle && activeVehicle.parameterManager.parameterDownloadSkipped ? qsTr("Parameters not available") : qsTr("Waiting for parameters...")
33
34 QGCLabel {
35 text: control._waitingForParamsText
36 visible: waitForParameters && !parametersReady
37 }
38
39 Loader {
40 id: contentItemLoader
41 Layout.alignment: Qt.AlignTop
42 Layout.fillWidth: fillWindow
43 sourceComponent: _showMainComponent ? contentComponent : undefined
44
45 property var pageProperties: control.pageProperties
46 }
47
48 Rectangle {
49 id: divider
50 Layout.preferredWidth: visible ? 1 : -1
51 Layout.fillHeight: true
52 color: QGroundControl.globalPalette.groupBorder
53 visible: expanded
54 }
55
56 QGCLabel {
57 text: activeVehicle && activeVehicle.parameterManager.parameterDownloadSkipped ? qsTr("Parameters not available") : qsTr("Waiting for parameters...")
58 visible: expanded && !_expandedParametersReady
59 Layout.alignment: Qt.AlignTop
60 }
61
62 Loader {
63 id: expandedItemLoader
64 objectName: "indicatorExpandedLoader"
65 Layout.alignment: Qt.AlignTop
66 Layout.preferredWidth: visible ? -1 : 0
67 visible: expanded && _expandedParametersReady
68 sourceComponent: expanded && _expandedParametersReady ? expandedComponent : undefined
69
70 property var pageProperties: control.pageProperties
71 }
72}