fix property changed signals firing multiple times

This commit is contained in:
2026-08-18 19:25:03 +02:00
parent 8ec454306f
commit 59213cf30d
4 changed files with 101 additions and 39 deletions
+7 -7
View File
@@ -15,6 +15,10 @@ CarouselView {
readonly property var values: Wallpapers.query(root.search.text.split(" ").slice(1).join(" "))
required property var visibilities
currentIndex: {
const idx = Wallpapers.list.findIndex(w => w.path === Wallpapers.actualCurrent);
return idx >= 0 ? idx : 0;
}
delegateProperties: ({
visibilities: root.visibilities
})
@@ -41,13 +45,9 @@ CarouselView {
}
}
Component.onCompleted: {
const idx = Wallpapers.list.findIndex(w => w.path === Wallpapers.actualCurrent);
if (idx >= 0)
jumpToIndex(idx);
}
Component.onDestruction: Wallpapers.stopPreview()
onPreviewIndexChanged: (realIndex, modelData) => {
Wallpapers.preview(modelData.path);
onCurrentItemChanged: {
if (currentItem)
Wallpapers.preview(currentItem.modelData.path);
}
}