Commit bdeaada4 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

wallpapers: Rely on BackgroundsModel.count to know when the wallpapers changed

If we make it a Qt.binding it will update automatically and we won't be
needing to listen to different signals.
Same goes for cfg_Image.
parent 840c61b8
......@@ -360,18 +360,7 @@ ColumnLayout {
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()
view.currentIndex = Qt.binding(function() { return Math.min(imageModel.indexOf(cfg_Image), imageModel.count - 1) });
}
//kill the space for label under thumbnails
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment