Browse Source

Handle window initial and minimal size

Enable full screen / windowed toggle
QGC4.4
Gus Grubba 6 years ago
parent
commit
033b9fc845
  1. 28
      src/ui/MainRootWindow.qml
  2. 32
      src/ui/preferences/DebugWindow.qml

28
src/ui/MainRootWindow.qml

@ -12,6 +12,7 @@ import QtQuick 2.11
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.11 import QtQuick.Layouts 1.11
import QtQuick.Window 2.11
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
@ -23,12 +24,18 @@ import QGroundControl.FlightMap 1.0
/// Native QML top level window /// Native QML top level window
ApplicationWindow { ApplicationWindow {
id: mainWindow id: mainWindow
width: 1280 width: ScreenTools.isMobile ? Screen.width : Math.min(250 * Screen.pixelDensity, Screen.width)
height: 720 height: ScreenTools.isMobile ? Screen.height : Math.min(150 * Screen.pixelDensity, Screen.height)
minimumWidth: 920 minimumWidth: ScreenTools.isMobile ? Screen.width : Math.min(215 * Screen.pixelDensity, Screen.width)
minimumHeight: 646 minimumHeight: ScreenTools.isMobile ? Screen.height : Math.min(120 * Screen.pixelDensity, Screen.height)
visible: true visible: true
Component.onCompleted: {
if(ScreenTools.isMobile) {
mainWindow.showFullScreen()
}
}
readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5 readonly property real _topBottomMargins: ScreenTools.defaultFontPixelHeight * 0.5
readonly property string _mainToolbar: QGroundControl.corePlugin.options.mainToolbarUrl readonly property string _mainToolbar: QGroundControl.corePlugin.options.mainToolbarUrl
readonly property string _planToolbar: QGroundControl.corePlugin.options.planToolbarUrl readonly property string _planToolbar: QGroundControl.corePlugin.options.planToolbarUrl
@ -287,6 +294,18 @@ ApplicationWindow {
id: toolbar id: toolbar
anchors.fill: parent anchors.fill: parent
source: _mainToolbar 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 {
} }
} }

32
src/ui/preferences/DebugWindow.qml

@ -242,6 +242,38 @@ Item {
font.pointSize: 16 font.pointSize: 16
font.family: ScreenTools.normalFontFamily 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 { Rectangle {

Loading…
Cancel
Save