2017-04-27 18:25:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-11-13 18:31:03 +00:00
|
|
|
#ifndef FILTERMODELS_H
|
|
|
|
#define FILTERMODELS_H
|
|
|
|
|
2018-12-27 09:06:11 +00:00
|
|
|
#include "divetripmodel.h"
|
2018-10-29 13:56:48 +00:00
|
|
|
|
2014-11-13 18:31:03 +00:00
|
|
|
#include <QSortFilterProxyModel>
|
2019-12-09 14:37:26 +00:00
|
|
|
#include <memory>
|
2014-11-13 18:31:03 +00:00
|
|
|
|
2019-12-09 14:37:26 +00:00
|
|
|
// This proxy model sits on top of either a DiveTripList or DiveTripTree model
|
|
|
|
// and does filtering and/or sorting.
|
2014-11-13 18:31:03 +00:00
|
|
|
class MultiFilterSortModel : public QSortFilterProxyModel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
static MultiFilterSortModel *instance();
|
2018-09-29 20:13:44 +00:00
|
|
|
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
|
2018-10-29 19:17:53 +00:00
|
|
|
bool lessThan(const QModelIndex &, const QModelIndex &) const override;
|
2019-11-17 17:13:55 +00:00
|
|
|
|
2018-12-27 09:06:11 +00:00
|
|
|
void resetModel(DiveTripModelBase::Layout layout);
|
2019-11-27 20:55:37 +00:00
|
|
|
signals:
|
2020-03-11 10:30:51 +00:00
|
|
|
void selectionChanged(const QVector<QModelIndex> &indices);
|
2019-11-27 20:55:37 +00:00
|
|
|
void currentDiveChanged(QModelIndex index);
|
|
|
|
private slots:
|
2020-03-11 10:30:51 +00:00
|
|
|
void selectionChangedSlot(const QVector<QModelIndex> &indices);
|
2019-11-27 20:55:37 +00:00
|
|
|
void currentDiveChangedSlot(QModelIndex index);
|
2014-11-13 18:31:03 +00:00
|
|
|
private:
|
|
|
|
MultiFilterSortModel(QObject *parent = 0);
|
2019-12-09 14:37:26 +00:00
|
|
|
std::unique_ptr<DiveTripModelBase> model;
|
2014-11-13 18:31:03 +00:00
|
|
|
};
|
|
|
|
|
2014-11-13 21:45:32 +00:00
|
|
|
#endif
|