Wallpaper Selector: Improved GridView preferredHeight computation

This commit is contained in:
quadbyte 2025-08-13 00:56:37 -04:00
parent fe6a394448
commit 5b6ed3577a

View file

@ -105,7 +105,9 @@ Item {
// Wallpaper grid container // Wallpaper grid container
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 400 * scaling Layout.preferredHeight: {
return folderModel.count / wallpaperGridView.columns * wallpaperGridView.cellHeight
}
FolderListModel { FolderListModel {
id: folderModel id: folderModel
@ -122,10 +124,11 @@ Item {
model: folderModel model: folderModel
// Fixed 5 items per row - more aggressive sizing // Fixed 5 items per row - more aggressive sizing
property int columns: 5
property int itemSize: Math.floor( property int itemSize: Math.floor(
(width - leftMargin - rightMargin - (4 * Style.marginSmall * scaling)) / 5) (width - leftMargin - rightMargin - (4 * Style.marginSmall * scaling)) / columns)
cellWidth: Math.floor((width - leftMargin - rightMargin) / 5) cellWidth: Math.floor((width - leftMargin - rightMargin) / columns)
cellHeight: Math.floor(itemSize * 0.67) + Style.marginSmall * scaling cellHeight: Math.floor(itemSize * 0.67) + Style.marginSmall * scaling
leftMargin: Style.marginSmall * scaling leftMargin: Style.marginSmall * scaling