diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-10-29 14:56:48 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-11-01 07:28:15 -0700 |
commit | 803111ef02f84119f762ce495710edb2e7f40bdb (patch) | |
tree | c1b5e4813bd6d0592a94885a3c7522ad18c2a661 /qt-models/filtermodels.h | |
parent | 4636fcc83469309362c3925ef80ade589ea409a0 (diff) | |
download | subsurface-803111ef02f84119f762ce495710edb2e7f40bdb.tar.gz |
Dive list: make filter model aware of its source
The data-flow from C-core to list-view is as follows:
C-core --> DiveTripModel --> MultiSortFilterModel --> DiveListView
The control-flow, on the other hand, differs as DiveListView
accesses both MultiSortFilterModel and DiveTripModel, whereas
MultiSortFilterModel is mostly unaware of its source model.
This is in principle legitimate, as the MultiSortFilterModel might
be used for different sources. In our particular case, this is
not so. MultiSortFilterModel is written for a particular use case.
Therefore, model control-flow follow after data-flow: Let MultiSortFilterModel
set its own source model and DiveListView access the MultiSortFilterModel,
which then manages its source model.
This is not bike-shedding, but will enable a more flexible and
higher-performance sorting.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/filtermodels.h')
-rw-r--r-- | qt-models/filtermodels.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/qt-models/filtermodels.h b/qt-models/filtermodels.h index f962386a1..f579df1a9 100644 --- a/qt-models/filtermodels.h +++ b/qt-models/filtermodels.h @@ -2,6 +2,8 @@ #ifndef FILTERMODELS_H #define FILTERMODELS_H +#include "divetripmodel.h" // For DiveTripModel::Layout. TODO: remove in due course + #include <QStringListModel> #include <QSortFilterProxyModel> #include <stdint.h> @@ -132,6 +134,7 @@ slots: void startFilterDiveSite(struct dive_site *ds); void stopFilterDiveSite(); void filterChanged(const QModelIndex &from, const QModelIndex &to, const QVector<int> &roles); + void setLayout(DiveTripModel::Layout layout); signals: void filterFinished(); |