From 033b9fc84566e6aa65024c645d56e473fe3bbf9e Mon Sep 17 00:00:00 2001 From: Gus Grubba Date: Wed, 1 May 2019 12:00:06 -0400 Subject: [PATCH] Handle window initial and minimal size Enable full screen / windowed toggle --- src/ui/MainRootWindow.qml | 28 +++++++++++++++++++++----- src/ui/preferences/DebugWindow.qml | 32 ++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/src/ui/MainRootWindow.qml b/src/ui/MainRootWindow.qml index 7f51833de6..999bd2d2ff 100644 --- a/src/ui/MainRootWindow.qml +++ b/src/ui/MainRootWindow.qml @@ -12,6 +12,7 @@ import QtQuick 2.11 import QtQuick.Controls 2.4 import QtQuick.Dialogs 1.3 import QtQuick.Layouts 1.11 +import QtQuick.Window 2.11 import QGroundControl 1.0 import QGroundControl.Palette 1.0 @@ -23,12 +24,18 @@ import QGroundControl.FlightMap 1.0 /// Native QML top level window ApplicationWindow { id: mainWindow - width: 1280 - height: 720 - minimumWidth: 920 - minimumHeight: 646 + width: ScreenTools.isMobile ? Screen.width : Math.min(250 * Screen.pixelDensity, Screen.width) + height: ScreenTools.isMobile ? Screen.height : Math.min(150 * Screen.pixelDensity, Screen.height) + minimumWidth: ScreenTools.isMobile ? Screen.width : Math.min(215 * Screen.pixelDensity, Screen.width) + minimumHeight: ScreenTools.isMobile ? Screen.height : Math.min(120 * Screen.pixelDensity, Screen.height) visible: true + Component.onCompleted: { + if(ScreenTools.isMobile) { + mainWindow.showFullScreen() + } + } + readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5 readonly property string _mainToolbar: QGroundControl.corePlugin.options.mainToolbarUrl readonly property string _planToolbar: QGroundControl.corePlugin.options.planToolbarUrl @@ -287,6 +294,18 @@ ApplicationWindow { id: toolbar anchors.fill: parent source: _mainToolbar + //-- Toggle Full Screen / Windowed + MouseArea { + anchors.fill: parent + enabled: !ScreenTools.isMobile + onDoubleClicked: { + if(mainWindow.visibility === Window.Windowed) { + mainWindow.showFullScreen() + } else { + mainWindow.showNormal() + } + } + } } } @@ -594,4 +613,3 @@ ApplicationWindow { } } - diff --git a/src/ui/preferences/DebugWindow.qml b/src/ui/preferences/DebugWindow.qml index 266e5b613a..c4acea063c 100644 --- a/src/ui/preferences/DebugWindow.qml +++ b/src/ui/preferences/DebugWindow.qml @@ -242,6 +242,38 @@ Item { font.pointSize: 16 font.family: ScreenTools.normalFontFamily } + Text { + text: qsTr("Desktop Available Width:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: Screen.desktopAvailableWidth + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 16.5") + color: qgcPal.text + font.pointSize: 16.5 + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Desktop Available Height:") + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: Screen.desktopAvailableHeight + color: qgcPal.text + font.family: ScreenTools.normalFontFamily + } + Text { + text: qsTr("Font Point Size 17") + color: qgcPal.text + font.pointSize: 17 + font.family: ScreenTools.normalFontFamily + } } Rectangle { -- GitLab