Mobile: modify filter so that all models get notified

When we change the filter string, we need to make sure that the collapsed model is
also aware of the change.

Similarly, instead of just calling resetFilter and directly changing the core
data structures, we need to set the filter to the empty string which ensures
that all three models get notified and the view updates correctly.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2019-11-07 00:25:30 +01:00
parent 20fda8afc3
commit 15674f1a71
2 changed files with 2 additions and 1 deletions

View file

@ -557,7 +557,7 @@ Kirigami.ScrollablePage {
text: qsTr("Filter dives")
onTriggered: {
rootItem.filterToggle = !rootItem.filterToggle
diveModel.resetFilter()
manager.setFilter("")
numShownText = diveModel.shown()
}
}

View file

@ -2090,6 +2090,7 @@ void QMLManager::setFilter(const QString filterText)
QtConcurrent::run(QThreadPool::globalInstance(),
[=]{
DiveListSortModel::instance()->setFilter(filterText);
CollapsedDiveListSortModel::instance()->updateFilterState();
QMetaObject::invokeMethod(qmlWindow, "hideBusyAndConnectModel");
});
}