nosignal-shell/modules/nexus/pages/wallandstyle/WallpaperCategory.qml
2 * r + 2 * t 210130de43 fix: first wall row sizing when < max
Pad number of wallpapers to the number of walls in a row so when < they
dont expand to fill the entire row
2026-06-06 16:53:35 +10:00

53 lines
1.5 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Caelestia.Config
import Caelestia.Models
import qs.services
import qs.modules.nexus.common
PageBase {
id: root
title: {
const c = nState.selectedWallpaperCategory;
return c.slice(0, 1).toUpperCase() + c.slice(1);
}
isSubPage: true
GridLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
width: root.cappedWidth
columns: Config.nexus.wallpapersPerRow
rowSpacing: Tokens.spacing.medium
columnSpacing: Tokens.spacing.large
Repeater {
model: {
const walls = Wallpapers.list.filter(w => Wallpapers.getCategoryFor(w) === root.nState.selectedWallpaperCategory).sort((a, b) => a.name.localeCompare(b.name));
while (walls.length < Config.nexus.wallpapersPerRow)
walls.push(null);
return walls;
}
WallItem {
required property FileSystemEntry modelData
// Empty placeholders for sizing
opacity: modelData ? 1 : 0
enabled: modelData
source: String(modelData?.path ?? "")
text: modelData?.name ?? ""
onClicked: {
Wallpapers.setWallpaper(modelData.path);
root.nState.closeSubPage();
root.nState.closeSubPage();
}
}
}
}
}