diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-11-19 22:14:03 +0100 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2019-12-04 13:00:23 +0100 |
commit | 7d5c15f49a4f410a22716394673da79c0daad94b (patch) | |
tree | 3ee41b6ceed3075f44fa56ca93990def3d0ade23 /qt-models/divetripmodel.cpp | |
parent | c54e58e078f656222478ba62d736967fb1370cc8 (diff) | |
download | subsurface-7d5c15f49a4f410a22716394673da79c0daad94b.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r-- | qt-models/divetripmodel.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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<char> 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(); } |