Filter: update counts if dives added / removed

Update the filter counts if dives were added removed by the
undo commands. The undo commands call into the filter model
at the right time so that hidden_by_filter is already set.
The filter model keeps track of the counts and emits a signal,
which is caught by the widget.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-01-25 21:30:43 +01:00 committed by Dirk Hohndel
parent 3915e8a0d5
commit c210bfc0e0
5 changed files with 33 additions and 8 deletions

View file

@ -141,14 +141,6 @@ std::vector<dive *> DiveListBase::addDives(DivesAndTripsToAdd &toAdd)
std::vector<dive *> res;
res.resize(toAdd.dives.size());
// First, tell the filters that new dives are added. We do this here
// instead of later by signals, so that the filter can set the
// checkboxes of the new rows to its liking. The added dives will
// then appear in the correct shown/hidden state.
QVector<dive *> divesForFilter;
for (const DiveToAdd &entry: toAdd.dives)
divesForFilter.push_back(entry.dive.get());
// Now, add the dives
// Note: the idiomatic STL-way would be std::transform, but let's use a loop since
// that is closer to classical C-style.