From 68f16f5d79d959448486e1f494d8140c632fb6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jos=C3=A9=20Pereira?= Date: Thu, 22 Jul 2021 09:49:38 -0400 Subject: [PATCH] FlyViewWidgetLayer: Change layout based on layout option/state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Patrick José Pereira --- src/FlightDisplay/FlyViewWidgetLayer.qml | 50 ++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/FlightDisplay/FlyViewWidgetLayer.qml b/src/FlightDisplay/FlyViewWidgetLayer.qml index 2d351fd..8c7c47d 100644 --- a/src/FlightDisplay/FlyViewWidgetLayer.qml +++ b/src/FlightDisplay/FlyViewWidgetLayer.qml @@ -151,7 +151,53 @@ Item { id: telemetryPanel x: recalcXPosition() anchors.margins: _toolsMargin - anchors.bottom: parent.bottom + + // States for custom layout support + states: [ + State { + name: "bottom" + when: telemetryPanel.bottomMode + + AnchorChanges { + target: telemetryPanel + anchors.top: undefined + anchors.bottom: parent.bottom + anchors.right: undefined + anchors.verticalCenter: undefined + } + + PropertyChanges { + target: telemetryPanel + x: recalcXPosition() + } + }, + + State { + name: "right-video" + when: !telemetryPanel.bottomMode && photoVideoControl.visible + + AnchorChanges { + target: telemetryPanel + anchors.top: photoVideoControl.bottom + anchors.bottom: undefined + anchors.right: parent.right + anchors.verticalCenter: undefined + } + }, + + State { + name: "right-novideo" + when: !telemetryPanel.bottomMode && !photoVideoControl.visible + + AnchorChanges { + target: telemetryPanel + anchors.top: undefined + anchors.bottom: undefined + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + } + } + ] function recalcXPosition() { // First try centered @@ -167,8 +213,6 @@ Item { return parentToolInsets.leftEdgeBottomInset + _toolsMargin } } - - property real bottomInset: height } //-- Virtual Joystick