Commit ccef0fd9 authored by Gus Grubba's avatar Gus Grubba

Merge pull request #2087 from dogmaphobic/fixZOrder

Fix z order
parents f0d99039 7664ce33
......@@ -51,10 +51,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
......@@ -145,18 +141,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: [
......@@ -169,26 +165,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 {
......
......@@ -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 {
......
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -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 },
......
......@@ -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
......@@ -179,7 +179,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
......@@ -223,14 +223,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
......@@ -242,7 +240,7 @@ QGCView {
width: _rightPanelWidth
visible: _missionItems.count > 1
opacity: _rightPanelOpacity
z: editorMap.zOrderTopMost
z: QGroundControl.zOrderTopMost
ListView {
id: missionItemSummaryList
......@@ -295,7 +293,7 @@ Home Position Manager is commented out for now until a better implementation is
visible: homePositionManagerButton.checked
color: qgcPal.window
opacity: _rightPanelOpacity
z: editorMap.zOrderTopMost
z: QGroundControl.zOrderTopMost
Column {
anchors.margins: _margin
......@@ -571,7 +569,7 @@ Home Position Manager is commented out for now until a better implementation is
color: qgcPal.window
opacity: _rightPanelOpacity
radius: ScreenTools.defaultFontPixelHeight
z: editorMap.zOrderTopMost
z: QGroundControl.zOrderTopMost
readonly property real margins: ScreenTools.defaultFontPixelHeight
......@@ -767,7 +765,7 @@ Home Position Manager is commented out for now until a better implementation is
y: (parent.height - (_toolButtonCount * height) - ((_toolButtonCount - 1) * _margin)) / 2
buttonImage: "/qmlimages/MapAddMission.svg"
exclusiveGroup: _dropButtonsExclusiveGroup
z: editorMap.zOrderWidgets
z: QGroundControl.zOrderWidgets
onCheckedChanged: {
if (checked) {
......@@ -793,7 +791,7 @@ Home Position Manager is commented out for now until a better implementation is
anchors.top: addMissionItemsButton.bottom
buttonImage: "/qmlimages/TrashDelete.svg"
exclusiveGroup: _dropButtonsExclusiveGroup
z: editorMap.zOrderWidgets
z: QGroundControl.zOrderWidgets
onClicked: {
itemEditor.clearItem()
......@@ -812,7 +810,7 @@ Home Position Manager is commented out for now until a better implementation is
anchors.top: deleteMissionItemButton.bottom
buttonImage: "/qmlimages/MapHome.svg"
exclusiveGroup: _dropButtonsExclusiveGroup
z: editorMap.zOrderWidgets
z: QGroundControl.zOrderWidgets
}
*/
......@@ -825,7 +823,7 @@ Home Position Manager is commented out for now until a better implementation is
buttonImage: "/qmlimages/MapCenter.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: editorMap.zOrderWidgets
z: QGroundControl.zOrderWidgets
dropDownComponent: Component {
Column {
......@@ -870,7 +868,7 @@ Home Position Manager is commented out for now until a better implementation is
buttonImage: _syncNeeded ? "/qmlimages/MapSyncChanged.svg" : "/qmlimages/MapSync.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: editorMap.zOrderWidgets
z: QGroundControl.zOrderWidgets
dropDownComponent: syncDropDownComponent
enabled: !_syncInProgress
}
......@@ -884,7 +882,7 @@ Home Position Manager is commented out for now until a better implementation is
buttonImage: "/qmlimages/MapType.svg"
viewportMargins: ScreenTools.defaultFontPixelWidth / 2
exclusiveGroup: _dropButtonsExclusiveGroup
z: editorMap.zOrderWidgets
z: QGroundControl.zOrderWidgets
dropDownComponent: Component {
Column {
......@@ -921,7 +919,7 @@ Home Position Manager is commented out for now until a better implementation is
anchors.top: mapTypeButton.bottom
buttonImage: "/qmlimages/Help.svg"
exclusiveGroup: _dropButtonsExclusiveGroup
z: editorMap.zOrderWidgets
z: QGroundControl.zOrderWidgets
checked: _showHelp
}
} // FlightMap
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/// @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;
......
......@@ -28,6 +28,7 @@ along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
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 }
......
......@@ -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)
......@@ -103,7 +101,7 @@ Item {
id: toolbarLoader
width: parent.width
height: item ? item.height : 0
z: _root.zOrderTopMost
z: QGroundControl.zOrderTopMost
}
FlightDisplayView {
......@@ -113,8 +111,6 @@ Item {
anchors.top: toolbarLoader.bottom
anchors.bottom: parent.bottom
visible: true
property real zOrder: _root.zOrderTopMost
}
Loader {
......@@ -125,7 +121,6 @@ Item {
anchors.bottom: parent.bottom
visible: false
property real zOrder: _root.zOrderTopMost
property var tabletPosition: _root.tabletPosition
}
......@@ -137,7 +132,6 @@ Item {
anchors.bottom: parent.bottom
visible: false
property real zOrder: _root.zOrderTopMost
property var tabletPosition: _root.tabletPosition
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment