diff --git a/wallpapers/image/imagepackage/contents/ui/WallpaperDelegate.qml b/wallpapers/image/imagepackage/contents/ui/WallpaperDelegate.qml --- a/wallpapers/image/imagepackage/contents/ui/WallpaperDelegate.qml +++ b/wallpapers/image/imagepackage/contents/ui/WallpaperDelegate.qml @@ -30,7 +30,7 @@ id: wallpaperDelegate property alias color: backgroundRect.color - property bool selected: (wallpapersGrid.currentIndex === index) + readonly property bool selected: (view.currentIndex === index) opacity: model.pendingDeletion ? 0.5 : 1 text: model.display diff --git a/wallpapers/image/imagepackage/contents/ui/config.qml b/wallpapers/image/imagepackage/contents/ui/config.qml --- a/wallpapers/image/imagepackage/contents/ui/config.qml +++ b/wallpapers/image/imagepackage/contents/ui/config.qml @@ -63,6 +63,10 @@ onSlideshowModeChanged: cfg_SlideshowMode = slideshowMode } + onCfg_FillModeChanged: { + resizeComboBox.setMethod() + } + onCfg_SlidePathsChanged: { imageWallpaper.slidePaths = cfg_SlidePaths } @@ -114,7 +118,7 @@ function setMethod() { for (var i = 0; i < model.length; i++) { - if (model[i]["fillMode"] === wallpaper.configuration.FillMode) { + if (model[i]["fillMode"] === root.cfg_FillMode) { resizeComboBox.currentIndex = i; var tl = model[i]["label"].length; //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); @@ -312,13 +316,29 @@ id: wallpapersGrid anchors.fill: parent property var imageModel: (configDialog.currentWallpaper == "org.kde.image")? imageWallpaper.wallpaperModel : imageWallpaper.slideFilterModel - //that min is needed as the module will be populated in an async way - //and only on demand so we can't ensure it already exists - view.currentIndex: Math.min(imageModel.indexOf(cfg_Image), imageModel.rowCount()-1) + + function resetCurrentIndex() { + //that min is needed as the module will be populated in an async way + //and only on demand so we can't ensure it already exists + view.currentIndex = Math.min(imageModel.indexOf(cfg_Image), imageModel.rowCount()-1) + } + + Connections { + target: imageModel + onRowsInserted: resetCurrentIndex() + onRowsRemoved: resetCurrentIndex() + } + + Connections { + target: root + onCfg_ImageChanged: resetCurrentIndex() + } + //kill the space for label under thumbnails view.model: imageModel Component.onCompleted: { imageModel.usedInConfig = true; + resetCurrentIndex() } view.delegate: WallpaperDelegate { color: cfg_Color