From 7fa1943f653494a9122b9ca0f321730c25963ee2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 1 Sep 2021 18:02:26 +0200 Subject: [PATCH 1/2] Switch many loaders to asynchronous This allows the loaders to not block other actions while they are loading, improving startup speed and general item creation speed. --- src/controls/OverlayDrawer.qml | 2 ++ src/controls/Page.qml | 3 +++ src/controls/PageRow.qml | 1 + src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml | 2 ++ src/controls/private/globaltoolbar/TitlesPageHeader.qml | 2 ++ src/controls/private/globaltoolbar/ToolBarPageHeader.qml | 2 ++ src/controls/templates/ApplicationHeader.qml | 1 + src/controls/templates/SwipeListItem.qml | 1 + 8 files changed, 14 insertions(+) diff --git a/src/controls/OverlayDrawer.qml b/src/controls/OverlayDrawer.qml index df04e3816..2da4be85c 100644 --- a/src/controls/OverlayDrawer.qml +++ b/src/controls/OverlayDrawer.qml @@ -81,6 +81,8 @@ T.OverlayDrawer { Theme.backgroundColor: handleGraphics.Theme.backgroundColor Theme.textColor: handleGraphics.Theme.textColor + asynchronous: true + source: { var edge = root.edge; if (Qt.application.layoutDirection == Qt.RightToLeft) { diff --git a/src/controls/Page.qml b/src/controls/Page.qml index 105b5d828..229b840ad 100644 --- a/src/controls/Page.qml +++ b/src/controls/Page.qml @@ -382,6 +382,7 @@ QQC2.Page { property T2.StackView stack visible: active + asynchronous: true active: (root.titleDelegate !== defaultTitleDelegate || root.globalToolBarStyle === Kirigami.ApplicationHeaderStyle.ToolBar || root.globalToolBarStyle === Kirigami.ApplicationHeaderStyle.Titles) onActiveChanged: { if (active) { @@ -429,6 +430,8 @@ QQC2.Page { property Item page: root height: item ? item.implicitHeight : 0 + asynchronous: true + property bool pageComplete: false active: { diff --git a/src/controls/PageRow.qml b/src/controls/PageRow.qml index 9468a21a4..3455bcbd7 100644 --- a/src/controls/PageRow.qml +++ b/src/controls/PageRow.qml @@ -765,6 +765,7 @@ T.Control { active: globalToolBar.actualStyle != ApplicationHeaderStyle.None || (firstVisibleItem && firstVisibleItem.globalToolBarStyle == ApplicationHeaderStyle.ToolBar) visible: active height: active ? implicitHeight : 0 + asynchronous: true source: Qt.resolvedUrl("private/globaltoolbar/PageRowGlobalToolBarUI.qml"); } diff --git a/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml b/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml index 3ddf19dbd..8dbe24658 100644 --- a/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml +++ b/src/controls/private/globaltoolbar/PageRowGlobalToolBarUI.qml @@ -109,6 +109,8 @@ Kirigami.AbstractApplicationHeader { opacity: layerIsMainRow && active enabled: opacity > 0 + asynchronous: true + active: (globalToolBar.actualStyle == Kirigami.ApplicationHeaderStyle.TabBar || globalToolBar.actualStyle == Kirigami.ApplicationHeaderStyle.Breadcrumb) && currentItem && currentItem.globalToolBarStyle != Kirigami.ApplicationHeaderStyle.None //TODO: different implementation? diff --git a/src/controls/private/globaltoolbar/TitlesPageHeader.qml b/src/controls/private/globaltoolbar/TitlesPageHeader.qml index a7110266d..d822676eb 100644 --- a/src/controls/private/globaltoolbar/TitlesPageHeader.qml +++ b/src/controls/private/globaltoolbar/TitlesPageHeader.qml @@ -26,6 +26,8 @@ AbstractPageHeader { ? (item.Layout.preferredHeight > 0 ? item.Layout.preferredHeight : item.implicitHeight) : 0) + asynchronous: true + sourceComponent: page ? page.titleDelegate : null } } diff --git a/src/controls/private/globaltoolbar/ToolBarPageHeader.qml b/src/controls/private/globaltoolbar/ToolBarPageHeader.qml index 47e475b86..41373348e 100644 --- a/src/controls/private/globaltoolbar/ToolBarPageHeader.qml +++ b/src/controls/private/globaltoolbar/ToolBarPageHeader.qml @@ -41,6 +41,8 @@ AbstractPageHeader { Layout.preferredWidth: item ? item.Layout.preferredWidth : undefined Layout.maximumWidth: item ? item.Layout.maximumWidth : undefined + asynchronous: true + sourceComponent: page ? page.titleDelegate : null } diff --git a/src/controls/templates/ApplicationHeader.qml b/src/controls/templates/ApplicationHeader.qml index 6935652e2..3aa540633 100644 --- a/src/controls/templates/ApplicationHeader.qml +++ b/src/controls/templates/ApplicationHeader.qml @@ -197,6 +197,7 @@ AbstractApplicationHeader { Repeater { model: pageRow.layers.depth -1 delegate: Loader { + asynchronous: true sourceComponent: header.pageDelegate readonly property Page page: pageRow.layers.get(modelData+1) readonly property bool current: true; diff --git a/src/controls/templates/SwipeListItem.qml b/src/controls/templates/SwipeListItem.qml index e1a400c5f..9b0b0d1f9 100644 --- a/src/controls/templates/SwipeListItem.qml +++ b/src/controls/templates/SwipeListItem.qml @@ -220,6 +220,7 @@ T2.SwipeDelegate { width: item ? item.implicitWidth : actionsLayout.implicitWidth active: !listItem.alwaysVisibleActions && Kirigami.Settings.tabletMode visible: listItem.actionsVisible && opacity > 0 + asynchronous: true sourceComponent: handleComponent opacity: listItem.alwaysVisibleActions || Kirigami.Settings.tabletMode || listItem.hovered || !listItem.supportsMouseEvents ? 1 : 0 Behavior on opacity { -- GitLab From 117bcf9e70b75d4d0bc3c71e408614e7daaaef8d Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 2 Sep 2021 16:34:59 +0200 Subject: [PATCH 2/2] Fix PagePool test so it properly waits for things to clear on init() Otherwise we may not be in a proper clean state as the application is still processing events from a previous run. --- autotests/pagepool/tst_layers.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autotests/pagepool/tst_layers.qml b/autotests/pagepool/tst_layers.qml index 3b97ee077..fd602958c 100644 --- a/autotests/pagepool/tst_layers.qml +++ b/autotests/pagepool/tst_layers.qml @@ -57,6 +57,10 @@ TestCase { for (var spy of [stackSpy, layerSpy, checkSpy_A, checkSpy_B, checkSpy_C, checkSpy_D, checkSpy_E]) { spy.clear() } + + // Give mainWindow a bit of room to breathe so it can process item + // deletion and other delayed signals. + wait(10) } ActionGroup { -- GitLab