Filter: move recalculation of filter from FilterModel to TripModel

The way this was accessed via Qt's model semantics was horrible.
This gives arguably more readable code, since we don't have to
shoehorn things through QVariants.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-11-17 19:53:18 +01:00 committed by Dirk Hohndel
parent 9ffafbc326
commit 3003c6e1ee
8 changed files with 79 additions and 153 deletions

View file

@ -4,31 +4,18 @@
#include "divetripmodel.h"
#include <QStringListModel>
#include <QSortFilterProxyModel>
#include <QDateTime>
#include <stdint.h>
#include <vector>
class MultiFilterSortModel : public QSortFilterProxyModel {
Q_OBJECT
public:
static MultiFilterSortModel *instance();
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
bool updateDive(struct dive *d); // returns true if visibility status changed
bool lessThan(const QModelIndex &, const QModelIndex &) const override;
void resetModel(DiveTripModelBase::Layout layout);
void myInvalidate();
signals:
void filterFinished();
private:
MultiFilterSortModel(QObject *parent = 0);
// Dive site filtering has priority over other filters
void countsChanged();
};
#endif