Wallpaper Selector: Improved GridView preferredHeight computation
This commit is contained in:
parent
fe6a394448
commit
5b6ed3577a
1 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue