Splash: lazy load login screen
This commit is contained in:
@@ -5,6 +5,7 @@ import QtQuick.Controls
|
||||
|
||||
import "PStyle"
|
||||
import "Login"
|
||||
import "."
|
||||
|
||||
Window {
|
||||
visible: true
|
||||
@@ -12,11 +13,46 @@ Window {
|
||||
height: 480
|
||||
title: Qt.application.displayName
|
||||
|
||||
PBackground {
|
||||
anchors.fill: parent
|
||||
Component.onCompleted: {
|
||||
App.setup()
|
||||
loadingTimer.running = true
|
||||
}
|
||||
|
||||
Login {
|
||||
anchors.centerIn: parent
|
||||
Timer {
|
||||
id: loadingTimer
|
||||
|
||||
running: false
|
||||
repeat: false
|
||||
interval: 500
|
||||
|
||||
onTriggered: loader.source = "qrc:/Login/Login.qml"
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
anchors.fill: parent
|
||||
sourceComponent: loadingComponent
|
||||
}
|
||||
|
||||
Component {
|
||||
id: loadingComponent
|
||||
|
||||
PBackground {
|
||||
ColumnLayout {
|
||||
anchors.centerIn: parent
|
||||
spacing: 24
|
||||
|
||||
PBusyIndicator {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.preferredHeight: 48
|
||||
running: true
|
||||
}
|
||||
|
||||
PText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: qsTr("Loading application...")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user