From 15674f1a71be4fe74cf554e10f19e8570b90cb4f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 7 Nov 2019 00:25:30 +0100 Subject: 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 --- mobile-widgets/qml/DiveList.qml | 2 +- mobile-widgets/qmlmanager.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mobile-widgets/qml/DiveList.qml b/mobile-widgets/qml/DiveList.qml index 865feca35..f8b1744bd 100644 --- a/mobile-widgets/qml/DiveList.qml +++ b/mobile-widgets/qml/DiveList.qml @@ -557,7 +557,7 @@ Kirigami.ScrollablePage { text: qsTr("Filter dives") onTriggered: { rootItem.filterToggle = !rootItem.filterToggle - diveModel.resetFilter() + manager.setFilter("") numShownText = diveModel.shown() } } diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 81da8c67c..bace5aed6 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -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"); }); } -- cgit v1.2.3-70-g09d2