diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index 648b0084b40d67c13dc9231c004b668117d93f33..84f52ab5a47e7db63cd54d83237e62ed62b27034 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -46,7 +46,6 @@ FlightMap { property bool _disableVehicleTracking: false property bool _keepVehicleCentered: _mainIsMap ? false : true - // Track last known map position and zoom from Fly view in settings onZoomLevelChanged: QGroundControl.flightMapZoom = zoomLevel onCenterChanged: QGroundControl.flightMapPosition = center @@ -209,11 +208,11 @@ FlightMap { // Add trajectory points to the map MapItemView { model: _mainIsMap ? _activeVehicle ? _activeVehicle.trajectoryPoints : 0 : 0 - delegate: - MapPolyline { + + delegate: MapPolyline { line.width: 3 line.color: "red" - z: QGroundControl.zOrderMapItems - 2 + z: QGroundControl.zOrderTrajectoryLines path: [ object.coordinate1, object.coordinate2, @@ -224,13 +223,13 @@ FlightMap { // Add the vehicles to the map MapItemView { model: QGroundControl.multiVehicleManager.vehicles - delegate: - VehicleMapItem { + + delegate: VehicleMapItem { vehicle: object coordinate: object.coordinate isSatellite: flightMap.isSatelliteMap size: _mainIsMap ? ScreenTools.defaultFontPixelHeight * 3 : ScreenTools.defaultFontPixelHeight - z: QGroundControl.zOrderMapItems - 1 + z: QGroundControl.zOrderVehicles } } @@ -246,7 +245,7 @@ FlightMap { // Add lines between waypoints MissionLineView { - model: _mainIsMap ? missionController.waypointLines : 0 + model: _mainIsMap ? missionController.waypointLines : 0 } GeoFenceMapVisuals { diff --git a/src/FlightMap/MapItems/MissionLineView.qml b/src/FlightMap/MapItems/MissionLineView.qml index 5489bebc3406c997565cc780bb0740f3ea87c5de..2704e41be8e32149bb4dc43340a6064393bf634a 100644 --- a/src/FlightMap/MapItems/MissionLineView.qml +++ b/src/FlightMap/MapItems/MissionLineView.qml @@ -24,7 +24,7 @@ MapItemView { delegate: MapPolyline { line.width: 3 line.color: "#be781c" // Hack, can't get palette to work in here - z: QGroundControl.zOrderMapItems - 1 // Under item indicators + z: QGroundControl.zOrderWaypointLines path: [ object.coordinate1, diff --git a/src/PlanView/MissionItemEditor.qml b/src/PlanView/MissionItemEditor.qml index 005cac8883d331c81f3cd77f84a4b9b72003aa67..595d336602e42c14cb0fb19bdd8d91159c42ae4c 100644 --- a/src/PlanView/MissionItemEditor.qml +++ b/src/PlanView/MissionItemEditor.qml @@ -45,9 +45,17 @@ Rectangle { colorGroupEnabled: enabled } - MouseArea { + FocusScope { + id: currentItemScope anchors.fill: parent - onClicked: _root.clicked() + + MouseArea { + anchors.fill: parent + onClicked: { + currentItemScope.focus = true + _root.clicked() + } + } } QGCLabel { @@ -76,7 +84,14 @@ Rectangle { QGCMouseArea { fillItem: hamburger visible: hamburger.visible - onClicked: _waypointsOnlyMode ? waypointsOnlyMenu.popup() : normalMenu.popup() + onClicked: { + currentItemScope.focus = true + if (_waypointsOnlyMode) { + waypointsOnlyMenu.popup() + } else { + normalMenu.popup() + } + } Menu { id: normalMenu diff --git a/src/PlanView/SectionHeader.qml b/src/PlanView/SectionHeader.qml index f39ce133b532b8ef47f6a59b0d0703d7e41ecee4..bcc63abe3c97a2d53707e0b33bf6119a1979d2c8 100644 --- a/src/PlanView/SectionHeader.qml +++ b/src/PlanView/SectionHeader.qml @@ -6,12 +6,11 @@ import QtGraphicalEffects 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 -QGCMouseArea { +FocusScope { id: _root anchors.left: parent.left anchors.right: parent.right height: column.height - onClicked: checked = !checked property alias text: label.text property bool checked: true @@ -27,38 +26,47 @@ QGCMouseArea { QGCPalette { id: qgcPal; colorGroupEnabled: true } - ColumnLayout { - id: column - anchors.left: parent.left - anchors.right: parent.right + QGCMouseArea { + anchors.fill: parent - Item { - height: _sectionSpacer - width: 1 - visible: showSpacer + onClicked: { + _root.focus = true + checked = !checked } - QGCLabel { - id: label - Layout.fillWidth: true + ColumnLayout { + id: column + anchors.left: parent.left + anchors.right: parent.right - QGCColoredImage { - id: image - width: label.height / 2 - height: width - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - source: "/qmlimages/arrow-down.png" - color: qgcPal.text - visible: !_root.checked + Item { + height: _sectionSpacer + width: 1 + visible: showSpacer } - } - Rectangle { - anchors.left: parent.left - anchors.right: parent.right - height: 1 - color: qgcPal.text + QGCLabel { + id: label + Layout.fillWidth: true + + QGCColoredImage { + id: image + width: label.height / 2 + height: width + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + source: "/qmlimages/arrow-down.png" + color: qgcPal.text + visible: !_root.checked + } + } + + Rectangle { + anchors.left: parent.left + anchors.right: parent.right + height: 1 + color: qgcPal.text + } } } } diff --git a/src/QmlControls/QGCComboBox.qml b/src/QmlControls/QGCComboBox.qml index 1d30624cccecf45b1be2abd2fd417e13e8d78a1b..f703d6d64ce750a42c820c8686638ab11271ef23 100644 --- a/src/QmlControls/QGCComboBox.qml +++ b/src/QmlControls/QGCComboBox.qml @@ -68,7 +68,10 @@ Button { } } - onClicked: popup.toggleShow() + onClicked: { + combo.focus = true + popup.toggleShow() + } Component.onCompleted: { if (currentIndex === -1) { diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index 70f4abd4a250abf34508b9e7b606ef6554deee1d..ca9c96a1a0197661d0d5d145420ec50f886cc968 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -51,9 +51,13 @@ public: Q_PROPERTY(int supportedFirmwareCount READ supportedFirmwareCount 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 + 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) + Q_PROPERTY(qreal zOrderVehicles READ zOrderVehicles CONSTANT) + Q_PROPERTY(qreal zOrderWaypointIndicators READ zOrderWaypointIndicators CONSTANT) + Q_PROPERTY(qreal zOrderTrajectoryLines READ zOrderTrajectoryLines CONSTANT) + Q_PROPERTY(qreal zOrderWaypointLines READ zOrderWaypointLines CONSTANT) //------------------------------------------------------------------------- // MavLink Protocol @@ -135,9 +139,13 @@ public: static QGeoCoordinate flightMapPosition (); static double flightMapZoom (); - qreal zOrderTopMost () { return 1000; } - qreal zOrderWidgets () { return 100; } - qreal zOrderMapItems () { return 50; } + qreal zOrderTopMost () { return 1000; } + qreal zOrderWidgets () { return 100; } + qreal zOrderMapItems () { return 50; } + qreal zOrderWaypointIndicators () { return 50; } + qreal zOrderVehicles () { return 49; } + qreal zOrderTrajectoryLines () { return 48; } + qreal zOrderWaypointLines () { return 47; } bool isVersionCheckEnabled () { return _toolbox->mavlinkProtocol()->versionCheckEnabled(); } int mavlinkSystemID () { return _toolbox->mavlinkProtocol()->getSystemId(); } diff --git a/src/QmlControls/ToolStrip.qml b/src/QmlControls/ToolStrip.qml index c851cdb7b510fc786219178c35ea60db696272b6..9152a7f24d92c6639a08d1af99f8cf90422ab559 100644 --- a/src/QmlControls/ToolStrip.qml +++ b/src/QmlControls/ToolStrip.qml @@ -163,71 +163,77 @@ Rectangle { visible: index == 0 ? _showOptionalElements : true } - Rectangle { + FocusScope { + id: scope anchors.left: parent.left anchors.right: parent.right height: width - color: checked ? _repeaterPal.buttonHighlight : _repeaterPal.button - - QGCColoredImage { - id: button - anchors.fill: parent - source: _source - sourceSize.height: parent.height - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - color: checked ? _repeaterPal.buttonHighlightText : _repeaterPal.buttonText - - RotationAnimation on rotation { - id: imageRotation - loops: Animation.Infinite - from: 0 - to: 360 - duration: 500 - running: false - } - NumberAnimation on opacity { - id: opacityAnimation - running: false - from: 0 - to: 1.0 - loops: Animation.Infinite - duration: 2000 + Rectangle { + anchors.fill: parent + color: checked ? _repeaterPal.buttonHighlight : _repeaterPal.button + + QGCColoredImage { + id: button + anchors.fill: parent + source: _source + sourceSize.height: parent.height + fillMode: Image.PreserveAspectFit + mipmap: true + smooth: true + color: checked ? _repeaterPal.buttonHighlightText : _repeaterPal.buttonText + + RotationAnimation on rotation { + id: imageRotation + loops: Animation.Infinite + from: 0 + to: 360 + duration: 500 + running: false + } + + NumberAnimation on opacity { + id: opacityAnimation + running: false + from: 0 + to: 1.0 + loops: Animation.Infinite + duration: 2000 + } } - } - QGCMouseArea { - // Size of mouse area is expanded to make touch easier - anchors.leftMargin: -buttonStripColumn.anchors.margins - anchors.rightMargin: -buttonStripColumn.anchors.margins - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - height: parent.height + (_showOptionalElements? buttonLabel.height + buttonColumn.spacing : 0) - visible: _buttonEnabled - preventStealing: true - - onClicked: { - if (modelData.dropPanelComponent === undefined) { - dropPanel.hide() - if (modelData.toggle === true) { - checked = !checked - } else { - // dropPanel.hide above will close panel, but we need to do this to clear toggles - uncheckAll() - } - _root.clicked(index, checked) - } else { - if (checked) { - dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if + QGCMouseArea { + // Size of mouse area is expanded to make touch easier + anchors.leftMargin: -buttonStripColumn.anchors.margins + anchors.rightMargin: -buttonStripColumn.anchors.margins + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + height: parent.height + (_showOptionalElements? buttonLabel.height + buttonColumn.spacing : 0) + visible: _buttonEnabled + preventStealing: true + + onClicked: { + scope.focus = true + if (modelData.dropPanelComponent === undefined) { + dropPanel.hide() + if (modelData.toggle === true) { + checked = !checked + } else { + // dropPanel.hide above will close panel, but we need to do this to clear toggles + uncheckAll() + } + _root.clicked(index, checked) } else { - dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if - uncheckAll() - checked = true - var panelEdgeTopPoint = mapToItem(_root, width, 0) - dropPanel.show(panelEdgeTopPoint, height, modelData.dropPanelComponent) + if (checked) { + dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if + } else { + dropPanel.hide() // hide affects checked, so this needs to be duplicated inside not outside if + uncheckAll() + checked = true + var panelEdgeTopPoint = mapToItem(_root, width, 0) + dropPanel.show(panelEdgeTopPoint, height, modelData.dropPanelComponent) + } } } } diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index 7bb3c7713e2ca05634b799d30ef54cecfaab10a4..7a2642ecd26b6a704578d14c664bf2fc5c10570d 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -345,17 +345,6 @@ QGCView { anchors.fill: parent } - CenterMapDropButton { - anchors.margins: _margins - anchors.left: parent.left - anchors.top: parent.top - map: _map - z: QGroundControl.zOrderTopMost - showMission: false - showAllItems: false - visible: addNewSetView.visible - } - MapScale { anchors.leftMargin: ScreenTools.defaultFontPixelWidth / 2 anchors.bottomMargin: anchors.leftMargin @@ -602,6 +591,17 @@ QGCView { } // Map } } // Item - Add new set view + + CenterMapDropButton { + topMargin: 0 + anchors.margins: _margins + anchors.left: map.left + anchors.top: map.top + map: _map + showMission: false + showAllItems: false + visible: addNewSetView.visible + } } // Map //-- Add new set dialog