diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-03-22 20:55:05 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-12 18:19:07 +0300 |
commit | 9afea37e15db29f59048d1bc2553838943ca1b62 (patch) | |
tree | 784c76adcc6da786c32254b2aa400631d68753b3 /qt-models/filtermodels.cpp | |
parent | e7063b6b08dff5c35436a5fb16fcf3f81717ca52 (diff) | |
download | subsurface-9afea37e15db29f59048d1bc2553838943ca1b62.tar.gz |
Undo: update filter flag when dives change
The filter code is strange: it actually only checks the
dive->hidden_by_filter flag. Thus, before propagating the dive
changed signal, this flag has to be updated. Do this in the
DiveTripModel. Ultimately, this should be refactored.
Moreover, if the filter-flag changed notify the frontend
of a changed trip so that the trip is hidden / unhidden.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/filtermodels.cpp')
-rw-r--r-- | qt-models/filtermodels.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index 5fd9ed1f7..a0c910244 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -249,6 +249,18 @@ void MultiFilterSortModel::myInvalidate() #endif } +bool MultiFilterSortModel::updateDive(struct dive *d) +{ + bool oldStatus = !d->hidden_by_filter; + bool newStatus = showDive(d); + bool changed = oldStatus != newStatus; + if (changed) { + filter_dive(d, newStatus); + divesDisplayed += newStatus - oldStatus; + } + return changed; +} + void MultiFilterSortModel::clearFilter() { myInvalidate(); |