diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 847245c3cfde529ea0708698f8dc6de17d3314e6..9b56f0cc6a4fbfd0b1923d1190d2e756e2f3672c 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -48,10 +48,6 @@ Item { // Prevents z order drawing problems. property bool hideWidgets: false - readonly property alias zOrderTopMost: flightMap.zOrderTopMost - readonly property alias zOrderWidgets: flightMap.zOrderWidgets - readonly property alias zOrderMapItems: flightMap.zOrderMapItems - QGCPalette { id: qgcPal; colorGroupEnabled: enabled } property var _activeVehicle: multiVehicleManager.activeVehicle @@ -144,18 +140,18 @@ Item { label: "H" coordinate: (_activeVehicle && _activeVehicle.homePositionAvailable) ? _activeVehicle.homePosition : QtPositioning.coordinate(0, 0) visible: _activeVehicle ? _activeVehicle.homePositionAvailable : false - z: flightMap.zOrderMapItems + z: QGroundControl.zOrderMapItems } // Add trajectory points to the map MapItemView { model: multiVehicleManager.activeVehicle ? multiVehicleManager.activeVehicle.trajectoryPoints : 0 - + delegate: MapPolyline { line.width: 3 line.color: "orange" - z: flightMap.zOrderMapItems - 1 + z: QGroundControl.zOrderMapItems - 1 path: [ @@ -168,26 +164,24 @@ Item { // Add the vehicles to the map MapItemView { model: multiVehicleManager.vehicles - + delegate: VehicleMapItem { vehicle: object coordinate: object.coordinate isSatellite: flightMap.isSatelliteMap - z: flightMap.zOrderMapItems + z: QGroundControl.zOrderMapItems } } // Add the mission items to the map MissionItemView { model: _missionController.missionItems - zOrderMapItems: flightMap.zOrderMapItems } // Add lines between waypoints MissionLineView { model: _missionController.waypointLines - zOrderMapItems: flightMap.zOrderMapItems } Loader { diff --git a/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml b/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml index 7660a859c1d11fe5fa84ad76c37cfecc1872fc54..b530032bae8aaa47b15edfcf49c69c98510f5e5a 100644 --- a/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml +++ b/src/FlightDisplay/FlightDisplayViewDelayLoadInner.qml @@ -53,7 +53,7 @@ Item { horizontalAlignment: Text.AlignHCenter visible: object.satelliteLock < 2 text: "No GPS Lock for Vehicle #" + object.id - z: flightMap.zOrderMapItems - 2 + z: QGroundControl.zOrderMapItems - 2 } } } @@ -66,7 +66,7 @@ Item { size: ScreenTools.defaultFontPixelSize * (13.3) heading: _heading active: multiVehicleManager.activeVehicleAvailable - z: flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets } QGCAttitudeWidget { @@ -77,7 +77,7 @@ Item { rollAngle: _roll pitchAngle: _pitch active: multiVehicleManager.activeVehicleAvailable - z: flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets } DropButton { @@ -89,7 +89,7 @@ Item { buttonImage: "/qmlimages/MapCenter.svg" viewportMargins: ScreenTools.defaultFontPixelWidth / 2 exclusiveGroup: _dropButtonsExclusiveGroup - z: flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets dropDownComponent: Component { Row { @@ -134,7 +134,7 @@ Item { buttonImage: "/qmlimages/MapType.svg" viewportMargins: ScreenTools.defaultFontPixelWidth / 2 exclusiveGroup: _dropButtonsExclusiveGroup - z: flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets dropDownComponent: Component { Row { diff --git a/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml b/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml index ef454e0c27805aadc6afda1362e1408563a65975..b57e36906c49b729317767dc6b7126f371c2ad06 100644 --- a/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml +++ b/src/FlightDisplay/FlightDisplayViewDelayLoadOuter.qml @@ -52,7 +52,7 @@ Item { height: ScreenTools.defaultFontPixelSize * (10) heading: _heading active: multiVehicleManager.activeVehicleAvailable - z: _flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets } QGCAttitudeHUD { @@ -62,7 +62,7 @@ Item { width: ScreenTools.defaultFontPixelSize * (30) height: ScreenTools.defaultFontPixelSize * (30) active: multiVehicleManager.activeVehicleAvailable - z: _flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets } } @@ -71,7 +71,7 @@ Item { height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 width: ScreenTools.defaultFontPixelSize * (5) altitude: _altitudeWGS84 - z: _flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets visible: !hideWidgets } @@ -80,7 +80,7 @@ Item { width: ScreenTools.defaultFontPixelSize * (5) height: parent.height * 0.65 > ScreenTools.defaultFontPixelSize * (23.4) ? ScreenTools.defaultFontPixelSize * (23.4) : parent.height * 0.65 speed: _groundSpeed - z: _flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets visible: !hideWidgets } @@ -90,7 +90,7 @@ Item { airspeed: _airSpeed groundspeed: _groundSpeed active: multiVehicleManager.activeVehicleAvailable - z: _flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets visible: !hideWidgets } @@ -100,15 +100,15 @@ Item { altitude: _altitudeWGS84 vertZ: _climbRate active: multiVehicleManager.activeVehicleAvailable - z: _flightMap.zOrderWidgets - visible: !hideWidgets + z: QGroundControl.zOrderWidgets + visible: !hideWidgets } QGCButton { id: optionsButton x: _flightMap.mapWidgets.x y: _flightMap.mapWidgets.y - height - (ScreenTools.defaultFontPixelHeight / 2) - z: _flightMap.zOrderWidgets + z: QGroundControl.zOrderWidgets width: _flightMap.mapWidgets.width text: "Options" menu: optionsMenu diff --git a/src/FlightMap/FlightMap.qml b/src/FlightMap/FlightMap.qml index fa696a392fd9873e7969f4dd1186b089dbbac9c3..dd8641c3bf54960a00faaf1cf97e0d2c11ec396e 100644 --- a/src/FlightMap/FlightMap.qml +++ b/src/FlightMap/FlightMap.qml @@ -55,10 +55,6 @@ Map { property real lon: (longitude >= -180 && longitude <= 180) ? longitude : 0 property real lat: (latitude >= -90 && latitude <= 90) ? latitude : 0 - readonly property real zOrderTopMost: 1000 ///< z order for top most items, toolbar, main window sub view - readonly property real zOrderWidgets: 100 ///< z order value to widgets, for example: zoom controls, hud widgetss - readonly property real zOrderMapItems: 50 ///< z order value for map items, for example: mission item indicators - readonly property real maxZoomLevel: 20 zoomLevel: 18 @@ -101,19 +97,19 @@ Map { readonly property real _zoomIncrement: 1.0 property real _buttonWidth: ScreenTools.defaultFontPixelWidth * 5 - + NumberAnimation { id: animateZoom - + property real startZoom property real endZoom - + target: _map properties: "zoomLevel" from: startZoom to: endZoom duration: 500 - + easing { type: Easing.OutExpo } @@ -122,10 +118,10 @@ Map { QGCButton { width: parent._buttonWidth - z: zOrderWidgets + z: QGroundControl.zOrderWidgets //iconSource: "/qmlimages/ZoomPlus.svg" text: "+" - + onClicked: { var endZoomLevel = _map.zoomLevel + parent._zoomIncrement if (endZoomLevel > _map.maximumZoomLevel) { @@ -136,13 +132,13 @@ Map { animateZoom.start() } } - + QGCButton { width: parent._buttonWidth - z: zOrderWidgets + z: QGroundControl.zOrderWidgets //iconSource: "/qmlimages/ZoomMinus.svg" text: "-" - + onClicked: { var endZoomLevel = _map.zoomLevel - parent._zoomIncrement if (endZoomLevel < _map.minimumZoomLevel) { @@ -159,9 +155,9 @@ Map { /* The slider and scale display are commented out for now to try to save real estate - DonLakeFlyer Not sure if I'll bring them back or not. Need room for waypoint list at bottom - + property variant scaleLengths: [5, 10, 25, 50, 100, 150, 250, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000] - + function formatDistance(meters) { var dist = Math.round(meters) @@ -192,7 +188,7 @@ Map { onZoomLevelChanged:{ scaleTimer.restart() } - + function calculateScale() { var coord1, coord2, dist, text, f f = 0 diff --git a/src/FlightMap/MapItems/MissionItemView.qml b/src/FlightMap/MapItems/MissionItemView.qml index 4d0264d754d265f8a54e45e0c4aed9953ee05f20..6ef0e94b23ee8d70d58d6250899a5e860ace1632 100644 --- a/src/FlightMap/MapItems/MissionItemView.qml +++ b/src/FlightMap/MapItems/MissionItemView.qml @@ -35,7 +35,6 @@ import QGroundControl.Controls 1.0 MapItemView { id: _root - property real zOrderMapItems ///< Z order for indicator property var itemDragger ///< Set to item drag control if you want to support drag delegate: MissionItemIndicator { @@ -43,8 +42,8 @@ MapItemView { label: object.homePosition ? "H" : object.sequenceNumber isCurrentItem: object.isCurrentItem coordinate: object.coordinate - z: zOrderMapItems visible: object.specifiesCoordinate && (!object.homePosition || object.homePositionValid) + z: QGroundControl.zOrderMapItems onClicked: setCurrentItem(object.sequenceNumber) diff --git a/src/FlightMap/MapItems/MissionLineView.qml b/src/FlightMap/MapItems/MissionLineView.qml index bbb078369938a40d52635b5af01566a762e6b436..32c1c7bf7c9eb29686c45ccb759acf3671f9e951 100644 --- a/src/FlightMap/MapItems/MissionLineView.qml +++ b/src/FlightMap/MapItems/MissionLineView.qml @@ -30,12 +30,10 @@ import QGroundControl.Palette 1.0 /// The MissionLineView control is used to add lines between mission items MapItemView { - property real zOrderMapItems ///< Z order for indicator - delegate: MapPolyline { line.width: 3 - line.color: "#be781c" // Hack, can't get palette to work in here - z: zOrderMapItems - 1 // Under item indicators + line.color: "#be781c" // Hack, can't get palette to work in here + z: QGroundControl.zOrderMapItems - 1 // Under item indicators path: [ { latitude: object.coordinate1.latitude, longitude: object.coordinate1.longitude }, diff --git a/src/MissionEditor/MissionEditor.qml b/src/MissionEditor/MissionEditor.qml index e840da76c341b7f9919ab6181a543ec729767dd8..61bc1ba47012b568225d51d6add9d86fef0e1f09 100644 --- a/src/MissionEditor/MissionEditor.qml +++ b/src/MissionEditor/MissionEditor.qml @@ -41,7 +41,7 @@ QGCView { viewPanel: panel // zOrder comes from the Loader in MainWindow.qml - z: zOrder + z: QGroundControl.zOrderTopMost readonly property int _decimalPlaces: 8 readonly property real _horizontalMargin: ScreenTools.defaultFontPixelWidth / 2 @@ -181,7 +181,7 @@ QGCView { width: ScreenTools.defaultFontPixelHeight * 7 height: ScreenTools.defaultFontPixelHeight * 7 visible: false - z: editorMap.zOrderMapItems + 1 // Above item icons + z: QGroundControl.zOrderMapItems + 1 // Above item icons property var missionItem property var missionItemIndicator @@ -225,14 +225,12 @@ QGCView { // Add the mission items to the map MissionItemView { model: controller.missionItems - zOrderMapItems: editorMap.zOrderMapItems itemDragger: itemEditor } // Add lines between waypoints MissionLineView { model: controller.waypointLines - zOrderMapItems: editorMap.zOrderMapItems } // Mission Item Editor @@ -244,7 +242,7 @@ QGCView { width: _rightPanelWidth visible: !homePositionManagerButton.checked && _missionItems.count > 1 opacity: _rightPanelOpacity - z: editorMap.zOrderTopMost + z: QGroundControl.zOrderTopMost ListView { id: missionItemSummaryList @@ -293,7 +291,7 @@ QGCView { visible: homePositionManagerButton.checked color: qgcPal.window opacity: _rightPanelOpacity - z: editorMap.zOrderTopMost + z: QGroundControl.zOrderTopMost Column { anchors.margins: _margin @@ -568,7 +566,7 @@ QGCView { color: qgcPal.window opacity: _rightPanelOpacity radius: ScreenTools.defaultFontPixelHeight - z: editorMap.zOrderTopMost + z: QGroundControl.zOrderTopMost readonly property real margins: ScreenTools.defaultFontPixelHeight @@ -760,7 +758,7 @@ QGCView { y: (parent.height - (_toolButtonCount * height) - ((_toolButtonCount - 1) * _margin)) / 2 buttonImage: "/qmlimages/MapAddMission.svg" exclusiveGroup: _dropButtonsExclusiveGroup - z: editorMap.zOrderWidgets + z: QGroundControl.zOrderWidgets onCheckedChanged: { if (checked) { @@ -786,7 +784,7 @@ QGCView { anchors.top: addMissionItemsButton.bottom buttonImage: "/qmlimages/TrashDelete.svg" exclusiveGroup: _dropButtonsExclusiveGroup - z: editorMap.zOrderWidgets + z: QGroundControl.zOrderWidgets onClicked: { itemEditor.clearItem() @@ -802,7 +800,7 @@ QGCView { anchors.top: deleteMissionItemButton.bottom buttonImage: "/qmlimages/MapHome.svg" exclusiveGroup: _dropButtonsExclusiveGroup - z: editorMap.zOrderWidgets + z: QGroundControl.zOrderWidgets } DropButton { @@ -814,7 +812,7 @@ QGCView { buttonImage: "/qmlimages/MapCenter.svg" viewportMargins: ScreenTools.defaultFontPixelWidth / 2 exclusiveGroup: _dropButtonsExclusiveGroup - z: editorMap.zOrderWidgets + z: QGroundControl.zOrderWidgets dropDownComponent: Component { Column { @@ -858,7 +856,7 @@ QGCView { buttonImage: _syncNeeded ? "/qmlimages/MapSyncChanged.svg" : "/qmlimages/MapSync.svg" viewportMargins: ScreenTools.defaultFontPixelWidth / 2 exclusiveGroup: _dropButtonsExclusiveGroup - z: editorMap.zOrderWidgets + z: QGroundControl.zOrderWidgets dropDownComponent: syncDropDownComponent enabled: !_syncInProgress } @@ -872,7 +870,7 @@ QGCView { buttonImage: "/qmlimages/MapType.svg" viewportMargins: ScreenTools.defaultFontPixelWidth / 2 exclusiveGroup: _dropButtonsExclusiveGroup - z: editorMap.zOrderWidgets + z: QGroundControl.zOrderWidgets dropDownComponent: Component { Column { @@ -909,7 +907,7 @@ QGCView { anchors.top: mapTypeButton.bottom buttonImage: "/qmlimages/Help.svg" exclusiveGroup: _dropButtonsExclusiveGroup - z: editorMap.zOrderWidgets + z: QGroundControl.zOrderWidgets checked: _showHelp } } // FlightMap diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index 5091dae4661d6a7d8f16da6ef337b87f8adce9dd..3a1260522b287e2447c45142f4a07b9770b70ceb 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -1,24 +1,24 @@ /*===================================================================== - + QGroundControl Open Source Ground Control Station - + (c) 2009 - 2014 QGROUNDCONTROL PROJECT - + This file is part of the QGROUNDCONTROL project - + QGROUNDCONTROL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + QGROUNDCONTROL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QGROUNDCONTROL. If not, see . - + ======================================================================*/ /// @file @@ -39,15 +39,23 @@ class QGroundControlQmlGlobal : public QObject public: QGroundControlQmlGlobal(QObject* parent = NULL); ~QGroundControlQmlGlobal(); - + Q_PROPERTY(HomePositionManager* homePositionManager READ homePositionManager CONSTANT) Q_PROPERTY(FlightMapSettings* flightMapSettings READ flightMapSettings CONSTANT) - + + Q_PROPERTY(qreal zOrderTopMost READ zOrderTopMost CONSTANT) ///< z order for top most items, toolbar, main window sub view + Q_PROPERTY(qreal zOrderWidgets READ zOrderWidgets CONSTANT) ///< z order value to widgets, for example: zoom controls, hud widgetss + Q_PROPERTY(qreal zOrderMapItems READ zOrderMapItems CONSTANT) ///< z order value for map items, for example: mission item indicators + // Property accesors - - HomePositionManager* homePositionManager(void) { return _homePositionManager; } - FlightMapSettings* flightMapSettings(void) { return _flightMapSettings; } - + + HomePositionManager* homePositionManager () { return _homePositionManager; } + FlightMapSettings* flightMapSettings () { return _flightMapSettings; } + + qreal zOrderTopMost () { return 1000; } + qreal zOrderWidgets () { return 100; } + qreal zOrderMapItems () { return 50; } + private: HomePositionManager* _homePositionManager; FlightMapSettings* _flightMapSettings; diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index 90cf70e26e770f916e3a6d01481b1c2e47c4e99c..712f7d4149537a609628dee2ad69bcb0ea60f261 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -28,6 +28,7 @@ along with QGROUNDCONTROL. If not, see . import QtQuick 2.3 import QtQuick.Controls 1.2 +import QGroundControl 1.0 import QGroundControl.AutoPilotPlugin 1.0 import QGroundControl.Palette 1.0 import QGroundControl.Controls 1.0 @@ -37,7 +38,7 @@ import QGroundControl.MultiVehicleManager 1.0 Rectangle { anchors.fill: parent color: qgcPal.window - z: zOrder // zOrder comes from the Loader in MainWindow.qml + z: QGroundControl.zOrderTopMost QGCPalette { id: qgcPal; colorGroupEnabled: true } diff --git a/src/ui/MainWindow.qml b/src/ui/MainWindow.qml index dc37c28615cc0bd4e11fed3894021941db503e31..15d4322fed92e65430a88bacb86434ea974c7732 100644 --- a/src/ui/MainWindow.qml +++ b/src/ui/MainWindow.qml @@ -25,6 +25,7 @@ import QtQuick 2.3 import QtQuick.Controls 1.2 import QtPositioning 5.2 +import QGroundControl 1.0 import QGroundControl.Controls 1.0 import QGroundControl.FlightDisplay 1.0 import QGroundControl.ScreenTools 1.0 @@ -46,7 +47,6 @@ Item { flightView.visible = true setupViewLoader.visible = false planViewLoader.visible = false - _root.hideWidgets = false } onShowPlanView: { @@ -56,7 +56,6 @@ Item { flightView.visible = false setupViewLoader.visible = false planViewLoader.visible = true - _root.hideWidgets = true } onShowSetupView: { @@ -66,7 +65,6 @@ Item { flightView.visible = false setupViewLoader.visible = true planViewLoader.visible = false - _root.hideWidgets = true } onShowToolbarMessage: _toolbar.showToolbarMessage(message) @@ -88,7 +86,7 @@ Item { id: toolbarLoader width: parent.width height: item ? item.height : 0 - z: _root.zOrderTopMost + z: QGroundControl.zOrderTopMost } FlightDisplayView { @@ -98,8 +96,6 @@ Item { anchors.top: toolbarLoader.bottom anchors.bottom: parent.bottom visible: true - - property real zOrder: _root.zOrderTopMost } Loader { @@ -109,8 +105,6 @@ Item { anchors.top: toolbarLoader.bottom anchors.bottom: parent.bottom visible: false - - property real zOrder: _root.zOrderTopMost } Loader { @@ -120,7 +114,5 @@ Item { anchors.top: toolbarLoader.bottom anchors.bottom: parent.bottom visible: false - - property real zOrder: _root.zOrderTopMost } }