Merge pull request #9 from ferrreo/fix-segfault

Fix segfault
This commit is contained in:
Lysec 2025-07-13 18:34:04 +02:00 committed by GitHub
commit a1da2ba22e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,7 +23,15 @@ PanelWindow {
Connections { Connections {
target: WallpaperManager target: WallpaperManager
function onWallpaperListChanged() { function onWallpaperListChanged() {
wallpapers = WallpaperManager.wallpaperList; wallpapers = WallpaperManager.wallpaperList
}
}
onVisibleChanged: {
if (wallpaperPanelModal.visible) {
wallpapers = WallpaperManager.wallpaperList
} else {
wallpapers = []
} }
} }
@ -104,7 +112,7 @@ PanelWindow {
cellWidth: Math.max(120, (scrollView.width / 3) - 12) cellWidth: Math.max(120, (scrollView.width / 3) - 12)
cellHeight: cellWidth * 0.6 cellHeight: cellWidth * 0.6
model: wallpapers model: wallpapers
cacheBuffer: 0 cacheBuffer: 32
leftMargin: 8 leftMargin: 8
rightMargin: 8 rightMargin: 8
topMargin: 8 topMargin: 8
@ -112,30 +120,29 @@ PanelWindow {
delegate: Item { delegate: Item {
width: wallpaperGrid.cellWidth - 8 width: wallpaperGrid.cellWidth - 8
height: wallpaperGrid.cellHeight - 8 height: wallpaperGrid.cellHeight - 8
MouseArea { ClippingRectangle {
id: wallpaperItem
anchors.fill: parent anchors.fill: parent
hoverEnabled: true anchors.margins: 4
onClicked: { color: Qt.darker(Theme.backgroundPrimary, 1.1)
WallpaperManager.changeWallpaper(modelData); radius: 12
} border.color: Settings.currentWallpaper === modelData ? Theme.accentPrimary : Theme.outline
border.width: Settings.currentWallpaper === modelData ? 3 : 1
ClippingWrapperRectangle { Image {
id: wallpaperItem id: wallpaperImage
anchors.fill: parent anchors.fill: parent
anchors.margins: 4 source: modelData
color: Qt.darker(Theme.backgroundPrimary, 1.1) fillMode: Image.PreserveAspectCrop
radius: 12 asynchronous: true
border.color: Settings.currentWallpaper === modelData ? Theme.accentPrimary : Theme.outline cache: true
border.width: Settings.currentWallpaper === modelData ? 3 : 1 sourceSize.width: Math.min(width, 150)
Image { sourceSize.height: Math.min(height, 90)
id: wallpaperImage }
anchors.fill: parent MouseArea {
source: modelData anchors.fill: parent
fillMode: Image.PreserveAspectCrop hoverEnabled: true
asynchronous: true onClicked: {
cache: true WallpaperManager.changeWallpaper(modelData);
sourceSize.width: Math.min(width, 150)
sourceSize.height: Math.min(height, 90)
} }
} }
} }