mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
9ffafbc326
commit
3003c6e1ee
8 changed files with 79 additions and 153 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue