From 7d5c15f49a4f410a22716394673da79c0daad94b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 19 Nov 2019 22:14:03 +0100 Subject: Dive list model: send changed signals for top-level items In analogy to the tree-model send signals when dives change their shown status in the list-view. Do this in two passes (collect changes; send changes) to be able to reuse the already existing functions. Signed-off-by: Berthold Stoeger --- qt-models/divetripmodel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'qt-models') diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 5ecee7855..f75e37c7c 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -1320,6 +1320,12 @@ dive *DiveTripModelList::diveOrNull(const QModelIndex &index) const void DiveTripModelList::recalculateFilter() { + // Collect the changes in a vector used later to send signals. + // This could be solved more efficiently in one pass, but + // doing it in two passes allows us to use a common function without + // resorting to co-routines, lambdas or similar techniques. + std::vector changed; + changed.reserve(items.size()); { // This marker prevents the UI from getting notifications on selection changes. // It is active until the end of the scope. See comment in DiveTripModelTree::recalculateFilter(). @@ -1332,6 +1338,9 @@ void DiveTripModelList::recalculateFilter() } } + // Send the data-changed signals if some items changed visibility. + sendShownChangedSignals(changed, noParent); + emit diveListNotifier.numShownChanged(); emit diveListNotifier.filterReset(); } -- cgit v1.2.3-70-g09d2