aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-09-20 13:40:21 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-09-20 18:21:56 -0700
commit43390d4a9aa1a6c78e36ae2dd32e8421f9060c92 (patch)
tree199b52d722be2358ed2eb762b7977eb6488e4599
parent77781b936aeffec5d96e8cb7f75c12020cb2b6c3 (diff)
downloadsubsurface-43390d4a9aa1a6c78e36ae2dd32e8421f9060c92.tar.gz
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>
-rw-r--r--CHANGELOG.md2
-rw-r--r--qt-models/divetripmodel.cpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 70f19c881..e2dce6425 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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.
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp
index a48c827dd..8671a62b6 100644
--- a/qt-models/divetripmodel.cpp
+++ b/qt-models/divetripmodel.cpp
@@ -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) {