From 7d25fb1ed0d7c7439e19c339be01b552b8ce2ddf Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Thu, 18 Feb 2021 12:45:19 -0800 Subject: [PATCH] Fix display of vertical instrument panel --- src/FlightDisplay/FlyViewWidgetLayer.qml | 23 ++++++++++++++++++++- src/FlightMap/Widgets/PhotoVideoControl.qml | 2 +- .../Widgets/QGCInstrumentWidgetAlternate.qml | 24 ++++++++-------------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/FlightDisplay/FlyViewWidgetLayer.qml b/src/FlightDisplay/FlyViewWidgetLayer.qml index d13a03b..2d351fd 100644 --- a/src/FlightDisplay/FlyViewWidgetLayer.qml +++ b/src/FlightDisplay/FlyViewWidgetLayer.qml @@ -120,10 +120,31 @@ Item { } PhotoVideoControl { + id: photoVideoControl anchors.margins: _toolsMargin - anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right width: _rightPanelWidth + state: _verticalCenter ? "verticalCenter" : "topAnchor" + states: [ + State { + name: "verticalCenter" + AnchorChanges { + target: photoVideoControl + anchors.top: undefined + anchors.verticalCenter: _root.verticalCenter + } + }, + State { + name: "topAnchor" + AnchorChanges { + target: photoVideoControl + anchors.verticalCenter: undefined + anchors.top: instrumentPanel.bottom + } + } + ] + + property bool _verticalCenter: !QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel.rawValue } TelemetryValuesBar { diff --git a/src/FlightMap/Widgets/PhotoVideoControl.qml b/src/FlightMap/Widgets/PhotoVideoControl.qml index 808e734..bf85f97 100644 --- a/src/FlightMap/Widgets/PhotoVideoControl.qml +++ b/src/FlightMap/Widgets/PhotoVideoControl.qml @@ -27,7 +27,7 @@ Rectangle { height: mainLayout.height + (_margins * 2) color: "#80000000" radius: _margins - visible: !QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel.rawValue && (_mavlinkCamera || _videoStreamAvailable || _simpleCameraAvailable) && multiVehiclePanelSelector.showSingleVehiclePanel + visible: (_mavlinkCamera || _videoStreamAvailable || _simpleCameraAvailable) && multiVehiclePanelSelector.showSingleVehiclePanel property real _margins: ScreenTools.defaultFontPixelHeight / 2 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle diff --git a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml index 283a077..1c4b2b8 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml @@ -7,7 +7,6 @@ * ****************************************************************************/ - import QtQuick 2.3 import QGroundControl 1.0 @@ -18,30 +17,23 @@ import QGroundControl.FlightMap 1.0 import QGroundControl.Palette 1.0 Rectangle { - id: root - height: _outerRadius * 4 + _valuesWidget.height - radius: _outerRadius - color: qgcPal.window - - // These properties are expected to be in the Loader - // property real maxHeight - // property bool showValues - true: show value pages + height: _outerRadius * 4 + radius: _outerRadius + color: QGroundControl.globalPalette.window - property real _innerRadius: (width - (_topBottomMargin * 2)) / 2 - property real _outerRadius: _innerRadius + _topBottomMargin * 2 - property real _margins: (width * 0.05) / 2 + property real _outerMargin: (width * 0.05) / 2 + property real _outerRadius: width / 2 + property real _innerRadius: _outerRadius - _outerMargin // Prevent all clicks from going through to lower layers DeadMouseArea { anchors.fill: parent } - QGCPalette { id: qgcPal } - QGCAttitudeWidget { id: attitude anchors.horizontalCenter: parent.horizontalCenter - anchors.margins : _margins + anchors.topMargin: _outerMargin anchors.top: parent.top size: _innerRadius * 2 vehicle: globals.activeVehicle @@ -50,7 +42,7 @@ Rectangle { QGCCompassWidget { id: compass anchors.horizontalCenter: parent.horizontalCenter - anchors.margins: _margins + anchors.topMargin: _outerMargin * 2 anchors.top: attitude.bottom size: _innerRadius * 2 vehicle: globals.activeVehicle