subsurface/qt-models/filtermodels.h
Berthold Stoeger e7dafe36aa Dive list: clear dive data via the filter model
The UI talks to the filter model. Therefore route clearing of
data through that model instead of accessing the source model
directly.

This will allow us to remove the DiveTripModel::instance()
function and makes control flow less "jumpy".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-12-10 18:45:30 -08:00

28 lines
803 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef FILTERMODELS_H
#define FILTERMODELS_H
#include "divetripmodel.h"
#include <QSortFilterProxyModel>
class MultiFilterSortModel : public QSortFilterProxyModel {
Q_OBJECT
public:
static MultiFilterSortModel *instance();
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
bool lessThan(const QModelIndex &, const QModelIndex &) const override;
void resetModel(DiveTripModelBase::Layout layout);
void clear();
signals:
void selectionChanged(const QVector<QModelIndex> &indexes);
void currentDiveChanged(QModelIndex index);
private slots:
void selectionChangedSlot(const QVector<QModelIndex> &indexes);
void currentDiveChangedSlot(QModelIndex index);
private:
MultiFilterSortModel(QObject *parent = 0);
};
#endif