Wallpapers: added thumbnail caching. Had to drop the rounded borders for it to work.

NImageCached relies on the image being visible to work properly.
MultiEffect relies on the image being invisible to apply effects.
That's why we don't have rounded corners here, as we don't want to bring
back qt5compat.
This commit is contained in:
quadbyte 2025-08-17 17:48:39 -04:00
parent 7509bbd363
commit 89e359015e
3 changed files with 78 additions and 12 deletions

View file

@ -135,27 +135,32 @@ Item {
delegate: Rectangle {
id: wallpaperItem
property string wallpaperPath: modelData
property bool isSelected: wallpaperPath === WallpaperService.currentWallpaper
width: wallpaperGridView.itemSize
height: Math.floor(wallpaperGridView.itemSize * 0.67)
radius: Style.radiusMedium * scaling
color: isSelected ? Color.mPrimary : Color.mSurface
border.color: isSelected ? Color.mSecondary : Color.mOutline
border.width: Math.max(1, Style.borderThin * scaling)
clip: true
color: Color.transparent
NImageRounded {
anchors.fill: parent
anchors.margins: Style.marginTiny * scaling
// NImageCached relies on the image being visible to work properly.
// MultiEffect relies on the image being invisible to apply effects.
// That's why we don't have rounded corners here, as we don't want to bring back qt5compat.
NImageCached {
id: img
imagePath: wallpaperPath
fallbackIcon: "image"
imageRadius: Style.radiusMedium * scaling
anchors.fill: parent
}
// Selection indicator
// Borders on top
Rectangle {
anchors.fill: parent
color: Color.transparent
border.color: isSelected ? Color.mPrimary : Color.mOutline
border.width: Math.max(1, Style.borderThick * scaling)
}
// Selection tick-mark
Rectangle {
anchors.top: parent.top
anchors.right: parent.right