HLoader component, use Loader.asynchronous prop

This commit is contained in:
miruka 2019-08-11 23:25:22 -04:00
parent fbd7c45fe4
commit 5f72397afe
6 changed files with 15 additions and 9 deletions

View File

@ -2,9 +2,6 @@
- `QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling)` - `QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling)`
- Refactoring - Refactoring
- Remove clip props when possible
- `property list<thing>`
- See Loader.enabled and async
- Use [Animators](https://doc.qt.io/qt-5/qml-qtquick-animator.html) - Use [Animators](https://doc.qt.io/qt-5/qml-qtquick-animator.html)
- Sendbox - Sendbox
- SignIn/RememberAccount screens - SignIn/RememberAccount screens

6
src/qml/Base/HLoader.qml Normal file
View File

@ -0,0 +1,6 @@
import QtQuick 2.12
Loader {
asynchronous: true
visible: status == Loader.Ready
}

View File

@ -67,7 +67,7 @@ HBaseButton {
} }
} }
contentItem: Loader { contentItem: HLoader {
sourceComponent: sourceComponent:
loading && ! iconName ? loadingOverlay : buttonContent loading && ! iconName ? loadingOverlay : buttonContent
} }

View File

@ -18,7 +18,7 @@ HPage {
readonly property bool hasUnknownDevices: false readonly property bool hasUnknownDevices: false
header: Loader { header: HLoader {
id: roomHeader id: roomHeader
source: ready ? "RoomHeader.qml" : "" source: ready ? "RoomHeader.qml" : ""
@ -31,7 +31,7 @@ HPage {
page.leftPadding: 0 page.leftPadding: 0
page.rightPadding: 0 page.rightPadding: 0
Loader { HLoader {
source: ready ? "ChatSplitView.qml" : "../Base/HBusyIndicator.qml" source: ready ? "ChatSplitView.qml" : "../Base/HBusyIndicator.qml"
Layout.fillWidth: ready Layout.fillWidth: ready

View File

@ -46,7 +46,7 @@ HPage {
Layout.preferredHeight: childrenRect.height Layout.preferredHeight: childrenRect.height
Loader { HLoader {
width: parent.width width: parent.width
source: ready ? source: ready ?
modelData : modelData :

View File

@ -29,12 +29,15 @@ ApplicationWindow {
Shortcuts { id: shortcuts} Shortcuts { id: shortcuts}
Python { id: py } Python { id: py }
Loader { HLoader {
anchors.fill: parent anchors.fill: parent
source: py.ready ? "" : "LoadingScreen.qml" source: py.ready ? "" : "LoadingScreen.qml"
} }
Loader { HLoader {
// true makes the initially loaded chat page invisible for some reason
asynchronous: false
id: uiLoader id: uiLoader
anchors.fill: parent anchors.fill: parent
scale: py.ready ? 1 : 0.5 scale: py.ready ? 1 : 0.5