dive list: on reload update filter status

At some time, when introducing the global reset signal the filter
stopped being reloaded when loading a new log. This leads to very
strange UI behavior: dives disappear when editing fields unrelated
to the filter.

Therefore, when reloading the model, reset the filter. One might
argue whether this is the correct place. On the other hand, we
might even make the filter a sub-object of the dive-list model.
Let's think about this.

Partially solves #2961

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-09-20 13:40:21 +02:00 committed by Dirk Hohndel
parent 77781b936a
commit 43390d4a9a
2 changed files with 5 additions and 1 deletions

View file

@ -1,4 +1,4 @@
- update filter status when loading file [#2961]
---
* Always add new entries at the very top of this file above other existing entries and this note.

View file

@ -714,6 +714,8 @@ DiveTripModelTree::DiveTripModelTree(QObject *parent) : DiveTripModelBase(parent
void DiveTripModelTree::populate()
{
DiveFilter::instance()->updateAll(); // The data was reset - update filter status. TODO: should this really be done here?
// we want this to be two calls as the second text is overwritten below by the lines starting with "\r"
uiNotification(QObject::tr("populate data model"));
uiNotification(QObject::tr("start processing"));
@ -1479,6 +1481,8 @@ DiveTripModelList::DiveTripModelList(QObject *parent) : DiveTripModelBase(parent
void DiveTripModelList::populate()
{
DiveFilter::instance()->updateAll(); // The data was reset - update filter status. TODO: should this really be done here?
// Fill model
items.reserve(dive_table.nr);
for (int i = 0; i < dive_table.nr; ++i) {