diff options
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/filtermodels.cpp | 6 | ||||
-rw-r--r-- | qt-models/filtermodels.h | 24 |
2 files changed, 30 insertions, 0 deletions
diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp index 4063ba149..a6e80aa8f 100644 --- a/qt-models/filtermodels.cpp +++ b/qt-models/filtermodels.cpp @@ -711,3 +711,9 @@ bool MultiFilterSortModel::lessThan(const QModelIndex &i1, const QModelIndex &i2 // Hand sorting down to the source model. return model->lessThan(i1, i2); } + +void MultiFilterSortModel::filterDataChanged(const FilterData& data) +{ + filterData = data; + myInvalidate(); +} diff --git a/qt-models/filtermodels.h b/qt-models/filtermodels.h index 8830e99c3..6956146e1 100644 --- a/qt-models/filtermodels.h +++ b/qt-models/filtermodels.h @@ -6,6 +6,8 @@ #include <QStringListModel> #include <QSortFilterProxyModel> +#include <QDateTime> + #include <stdint.h> #include <vector> @@ -13,6 +15,25 @@ struct dive; struct dive_trip; class DiveTripModel; +struct FilterData { + bool validFilter = false; + int minVisibility = 0; + int maxVisibility = 5; + int minRating = 0; + int maxRating = 5; + double minWaterTemp = 0; + double maxWaterTemp = 100; + double minAirTemp = 0; + double maxAirTemp = 100; + QDateTime from; + QDateTime to = QDateTime::currentDateTime(); + QStringList tags; + QStringList people; + QStringList location; + QStringList equipment; + bool invertFilter; +}; + class FilterModelBase : public QAbstractListModel { Q_OBJECT private: @@ -137,14 +158,17 @@ slots: void stopFilterDiveSite(); void filterChanged(const QModelIndex &from, const QModelIndex &to, const QVector<int> &roles); void setLayout(DiveTripModel::Layout layout); + void filterDataChanged(const FilterData& data); signals: void filterFinished(); + private: MultiFilterSortModel(QObject *parent = 0); QList<FilterModelBase *> models; struct dive_site *curr_dive_site; DiveTripModel *model; + FilterData filterData; }; #endif |