From 290450ef5e39fbf818d38c18fbc77a931085f616 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Sat, 9 Nov 2019 04:41:47 -0800 Subject: [PATCH] New centered PlanEditToolbar --- src/MissionManager/QGCMapPolygonVisuals.qml | 9 +++++---- src/MissionManager/QGCMapPolylineVisuals.qml | 9 +++++---- src/PlanView/PlanEditToolbar.qml | 17 +++++++++-------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/MissionManager/QGCMapPolygonVisuals.qml b/src/MissionManager/QGCMapPolygonVisuals.qml index 7c51c0473..c00fb1b95 100644 --- a/src/MissionManager/QGCMapPolygonVisuals.qml +++ b/src/MissionManager/QGCMapPolygonVisuals.qml @@ -516,10 +516,11 @@ Item { id: toolbarComponent PlanEditToolbar { - x: mapControl.centerViewport.left - y: mapControl.centerViewport.top - width: mapControl.centerViewport.width - z: QGroundControl.zOrderMapItems + 2 + anchors.horizontalCenter: mapControl.left + anchors.horizontalCenterOffset: mapControl.centerViewport.left + (mapControl.centerViewport.width / 2) + y: mapControl.centerViewport.top + z: QGroundControl.zOrderMapItems + 2 + availableWidth: mapControl.centerViewport.width QGCButton { _horizontalPadding: 0 diff --git a/src/MissionManager/QGCMapPolylineVisuals.qml b/src/MissionManager/QGCMapPolylineVisuals.qml index fbd9a816a..ab88a61c9 100644 --- a/src/MissionManager/QGCMapPolylineVisuals.qml +++ b/src/MissionManager/QGCMapPolylineVisuals.qml @@ -314,10 +314,11 @@ Item { id: toolbarComponent PlanEditToolbar { - x: mapControl.centerViewport.left - y: mapControl.centerViewport.top - width: mapControl.centerViewport.width - z: QGroundControl.zOrderMapItems + 2 + anchors.horizontalCenter: mapControl.left + anchors.horizontalCenterOffset: mapControl.centerViewport.left + (mapControl.centerViewport.width / 2) + y: mapControl.centerViewport.top + z: QGroundControl.zOrderMapItems + 2 + availableWidth: mapControl.centerViewport.width QGCButton { _horizontalPadding: 0 diff --git a/src/PlanView/PlanEditToolbar.qml b/src/PlanView/PlanEditToolbar.qml index 7822e41a5..960194566 100644 --- a/src/PlanView/PlanEditToolbar.qml +++ b/src/PlanView/PlanEditToolbar.qml @@ -14,14 +14,18 @@ import QtQuick.Layouts 1.2 import QGroundControl 1.0 import QGroundControl.ScreenTools 1.0 import QGroundControl.Controls 1.0 +import QGroundControl.Palette 1.0 /// Toolbar used for things like Polygon editing tools Item { + width: Math.min(toolsRowLayout.width + (_margins * 2), availableWidth) height: toolsFlickable.y + toolsFlickable.height + _margins z: QGroundControl.zOrderMapItems + 2 - property real _radius: ScreenTools.defaultFontPixelWidth / 2 - property real _margins: ScreenTools.defaultFontPixelWidth / 2 + property real availableWidth + + property real _radius: ScreenTools.defaultFontPixelWidth / 2 + property real _margins: ScreenTools.defaultFontPixelWidth / 2 Component.onCompleted: { // Move the child controls from consumer into the layout control @@ -39,8 +43,7 @@ Item { Rectangle { anchors.fill: parent radius: _radius - color: "white" - opacity: 0.75 + color: qgcPal.globalTheme === QGCPalette.Light ? QGroundControl.corePlugin.options.toolbarBackgroundLight : QGroundControl.corePlugin.options.toolbarBackgroundDark } QGCFlickable { @@ -64,10 +67,8 @@ Item { id: instructionComponent QGCLabel { - id: instructionLabel - color: "black" - text: _instructionText - Layout.fillWidth: true + id: instructionLabel + text: _instructionText } } } -- 2.22.0