diff options
author | Samuli Piippo <samuli.piippo@qt.io> | 2020-10-20 12:06:53 +0300 |
---|---|---|
committer | Samuli Piippo <samuli.piippo@qt.io> | 2020-10-29 05:43:49 +0000 |
commit | 25842566eee73aa8f2b07dcd334d47d6f6853579 (patch) | |
tree | bf00d8f91ca3bc70a728aec4ae953e0a99f6d780 /startupscreen/StartupScreen.qml | |
parent | 84726988dad28ad4b7e77dcda7baddda094b90dd (diff) |
startupscreen: make UI dynamic
Dynamically adjust the UI element based on the screen size to better
handle the various screen sizes available in embedded devices.
Make states handle only the landscape - portrait changes.
Remove progress bar from splash screen and make it hide automoatically.
Remove SD card button and hide wifi button.
Change-Id: I308ad696cf4c2ee3b97adfc231cd76899152f357
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Diffstat (limited to 'startupscreen/StartupScreen.qml')
-rw-r--r-- | startupscreen/StartupScreen.qml | 80 |
1 files changed, 31 insertions, 49 deletions
diff --git a/startupscreen/StartupScreen.qml b/startupscreen/StartupScreen.qml index b4098b7..254dba2 100644 --- a/startupscreen/StartupScreen.qml +++ b/startupscreen/StartupScreen.qml @@ -48,19 +48,26 @@ ** ****************************************************************************/ -import QtQuick 2.12 -import QtQuick.Controls 2.15 -import StartupScreen 1.0 +import QtQuick +import QtQuick.Controls +import StartupScreen ApplicationWindow { id: bootUI visible: true - property bool isPortrait: false // true // - property int resolution: 1 + property bool isPortrait: height > width ? true : false - width: Constants.smallWidth - height: Constants.smallHeight + width: 640 + height: 480 + + Timer { + interval: 1000 + running: true + onTriggered: { + splashAnimator.running = true + } + } // for testing Item { @@ -69,59 +76,34 @@ ApplicationWindow { Keys.onPressed: { // rotate: toggle portrait/landscape if (event.key === Qt.Key_R) { - isPortrait? isPortrait = false: isPortrait = true - } - - // navigate from splash to main - else if (event.key === Qt.Key_Space){ - splash.opacity= 0 - main.opacity=1 - } - - // change window size - else if (event.key === Qt.Key_1) { - resolution = 1 - } - else if (event.key === Qt.Key_2) { - resolution = 2 - } - else if (event.key === Qt.Key_3) { - resolution = 3 - } - - // set width - if (resolution == 1){ - bootUI.width = isPortrait? Constants.smallHeight: Constants.smallWidth - bootUI.height= isPortrait? Constants.smallWidth: Constants.smallHeight - isPortrait? main.state = "smallPortrait": main.state = "" - } - else if (resolution == 2){ - bootUI.width = isPortrait? Constants.mediumHeight: Constants.mediumWidth - bootUI.height = isPortrait? Constants.mediumWidth: Constants.mediumHeight - isPortrait? main.state = "mediumPortrait": main.state = "mediumLandscape" - - } - else{ - bootUI.width = isPortrait? Constants.largeHeight: Constants.largeWidth - bootUI.height = isPortrait? Constants.largeWidth: Constants.largeHeight - isPortrait? main.state = "largePortrait": main.state = "largeLandscape" + var height = bootUI.height + bootUI.height = bootUI.width + bootUI.width = height } } } - SplashView { - id: splash + MainView { + id: main width: bootUI.width height: bootUI.height + state: isPortrait ? "portrait" : "" } - MainView { - id: main + SplashView { + id: splash width: bootUI.width height: bootUI.height - - opacity: 0 + opacity: 1 + OpacityAnimator { + id: splashAnimator + target: splash + from: 1 + to: 0 + duration: 2000 + } } + } |