controlcenter: lazyloading wallpaper
This commit is contained in:
parent
0e1be8126a
commit
f77323b136
1 changed files with 40 additions and 25 deletions
|
|
@ -1895,7 +1895,20 @@ RowLayout {
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Appearance.spacing.large
|
Layout.topMargin: Appearance.spacing.large
|
||||||
Layout.preferredHeight: wallpaperGrid.Layout.preferredHeight
|
Layout.preferredHeight: wallpaperLoader.item ? wallpaperLoader.item.layoutPreferredHeight : 0
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: wallpaperLoader
|
||||||
|
anchors.fill: parent
|
||||||
|
asynchronous: true
|
||||||
|
active: {
|
||||||
|
// Lazy load: only activate when right pane is loaded
|
||||||
|
// This defers heavy wallpaper list loading until the right pane is visible
|
||||||
|
return rightAppearanceLoader.item !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceComponent: Item {
|
||||||
|
property alias layoutPreferredHeight: wallpaperGrid.layoutPreferredHeight
|
||||||
|
|
||||||
GridView {
|
GridView {
|
||||||
id: wallpaperGrid
|
id: wallpaperGrid
|
||||||
|
|
@ -1904,8 +1917,8 @@ RowLayout {
|
||||||
readonly property int minCellWidth: 200 + Appearance.spacing.normal
|
readonly property int minCellWidth: 200 + Appearance.spacing.normal
|
||||||
readonly property int columnsCount: Math.max(1, Math.floor(parent.width / minCellWidth))
|
readonly property int columnsCount: Math.max(1, Math.floor(parent.width / minCellWidth))
|
||||||
|
|
||||||
Layout.preferredHeight: Math.ceil(count / columnsCount) * cellHeight
|
readonly property int layoutPreferredHeight: Math.ceil(count / columnsCount) * cellHeight
|
||||||
height: Layout.preferredHeight
|
height: layoutPreferredHeight
|
||||||
|
|
||||||
// Distribute width evenly across columns
|
// Distribute width evenly across columns
|
||||||
cellWidth: width / columnsCount
|
cellWidth: width / columnsCount
|
||||||
|
|
@ -2147,4 +2160,6 @@ RowLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue