launcher: limit wallpapers to screen width
This commit is contained in:
parent
d114f4c0bf
commit
3b31c2e1c8
1 changed files with 14 additions and 2 deletions
|
|
@ -10,6 +10,18 @@ PathView {
|
||||||
|
|
||||||
required property TextField search
|
required property TextField search
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
readonly property int numItems: {
|
||||||
|
const screenWidth = QsWindow.window?.screen.width - BorderConfig.thickness * 2 - BorderConfig.rounding * 4 - Appearance.padding.large * 2;
|
||||||
|
if (!screenWidth)
|
||||||
|
return 0;
|
||||||
|
const itemWidth = LauncherConfig.sizes.wallpaperWidth * 0.8;
|
||||||
|
const max = LauncherConfig.maxWallpapers;
|
||||||
|
if (max * itemWidth > screenWidth) {
|
||||||
|
const items = Math.floor(screenWidth / itemWidth);
|
||||||
|
return items > 1 && items % 2 === 0 ? items - 1 : items;
|
||||||
|
}
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
readonly property string search: root.search.text.split(" ").slice(1).join(" ")
|
readonly property string search: root.search.text.split(" ").slice(1).join(" ")
|
||||||
|
|
@ -31,8 +43,8 @@ PathView {
|
||||||
Wallpapers.preview(currentItem.modelData.path);
|
Wallpapers.preview(currentItem.modelData.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitWidth: Math.min(LauncherConfig.maxWallpapers, count) * (LauncherConfig.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
|
implicitWidth: Math.min(numItems, count) * (LauncherConfig.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2)
|
||||||
pathItemCount: LauncherConfig.maxWallpapers
|
pathItemCount: numItems
|
||||||
cacheItemCount: 4
|
cacheItemCount: 4
|
||||||
|
|
||||||
snapMode: PathView.SnapToItem
|
snapMode: PathView.SnapToItem
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue