shell: Load wallpaper selector only when necessary

This commit is contained in:
Devin Lin 2022-06-25 12:43:11 -04:00
parent d8399e88be
commit 1919a39d81
3 changed files with 9 additions and 4 deletions

View file

@ -22,7 +22,7 @@ GridView {
clip: true
readonly property int reservedSpaceForLabel: metrics.height
readonly property real effectiveContentWidth: width - leftMargin - rightMargin
required property real effectiveContentWidth
cellWidth: effectiveContentWidth / Math.min(Math.floor(effectiveContentWidth / (PlasmaCore.Units.iconSizes.huge + Kirigami.Units.largeSpacing * 2)), 8)
cellHeight: cellWidth + reservedSpaceForLabel

View file

@ -164,6 +164,7 @@ Item {
interactive: root.interactive
leftMargin: column.horizontalMargin
rightMargin: column.horizontalMargin
effectiveContentWidth: swipeView.width - leftMargin - rightMargin
Layout.fillWidth: true
Layout.fillHeight: true
}

View file

@ -34,10 +34,15 @@ AppletConfiguration {
}
//END model
// the wallpaper selector is quite heavy, so only load it when needed
Loader {
id: wallpaperSelectorLoader
asynchronous: true
active: true
active: false
onLoaded: {
wallpaperSelectorLoader.item.open();
}
sourceComponent: WallpaperSelector {
visible: false
@ -88,7 +93,7 @@ AppletConfiguration {
opacityAnim.from = 1;
opacityAnim.to = 0;
opacityAnim.restart();
wallpaperSelectorLoader.item.open();
wallpaperSelectorLoader.active = true;
}
}
@ -104,7 +109,6 @@ AppletConfiguration {
text: i18n("Configure")
onClicked: {
appComponent.visible = true;
wallpaperSelectorLoader.item.close()
}
}
}