Reset the grid current index when the grid content changes

`model` object doesn't really change so we can't use `onModelChanged` in QML to reset the index.
This commit is contained in:
Luis Ángel San Martín 2021-05-16 08:57:18 +02:00
parent 5f5ef6833d
commit e799513fb4

View File

@ -259,6 +259,12 @@ void GridComicsView::setModel(ComicModel *model)
ctxt->setContextProperty("dropManager", this);
ctxt->setContextProperty("comicInfoHelper", comicInfoHelper);
auto grid = view->rootObject()->findChild<QQuickItem *>(QStringLiteral("grid"));
if (grid != nullptr) {
grid->setProperty("currentIndex", 0);
}
updateBackgroundConfig();
selectionHelper->clear();