summaryrefslogtreecommitdiffstats
path: root/qt-models/filtermodels.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-11-25 16:15:57 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-11-25 08:24:36 -0800
commitdd2466f51899aae406dc8c13904787710f30ec1c (patch)
tree45a06a318509b0e1c7957ba09b4ca6ce0030de83 /qt-models/filtermodels.h
parent4da6a0a73261a34a71e8f95261769128c3c1df0b (diff)
downloadsubsurface-dd2466f51899aae406dc8c13904787710f30ec1c.tar.gz
Update filters on refreshDisplay and remember old selecttions
Update the filters if the list of dives is updated by calling MultiFilterSortModel::instance()->myInvalidate(); This had the side effect of clearing all selections. Thus, in the repopulate() methods of the FilterModels, check those entries that were checked previously. Since all the filter models use the same code, introduce a base class FilterModelBase. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/filtermodels.h')
-rw-r--r--qt-models/filtermodels.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/qt-models/filtermodels.h b/qt-models/filtermodels.h
index cda6e2369..3060f7cf3 100644
--- a/qt-models/filtermodels.h
+++ b/qt-models/filtermodels.h
@@ -16,7 +16,13 @@ public:
bool anyChecked;
};
-class TagFilterModel : public QStringListModel, public MultiFilterInterface {
+class FilterModelBase : public QStringListModel, public MultiFilterInterface {
+protected:
+ explicit FilterModelBase(QObject *parent = 0);
+ void updateList(const QStringList &new_list);
+};
+
+class TagFilterModel : public FilterModelBase {
Q_OBJECT
public:
static TagFilterModel *instance();
@@ -33,7 +39,7 @@ private:
explicit TagFilterModel(QObject *parent = 0);
};
-class BuddyFilterModel : public QStringListModel, public MultiFilterInterface {
+class BuddyFilterModel : public FilterModelBase {
Q_OBJECT
public:
static BuddyFilterModel *instance();
@@ -50,7 +56,7 @@ private:
explicit BuddyFilterModel(QObject *parent = 0);
};
-class LocationFilterModel : public QStringListModel, public MultiFilterInterface {
+class LocationFilterModel : public FilterModelBase {
Q_OBJECT
public:
static LocationFilterModel *instance();
@@ -67,7 +73,7 @@ private:
explicit LocationFilterModel(QObject *parent = 0);
};
-class SuitsFilterModel : public QStringListModel, public MultiFilterInterface {
+class SuitsFilterModel : public FilterModelBase {
Q_OBJECT
public:
static SuitsFilterModel *instance();