subsurface/qt-models/filtermodels.h
Robert C. Helling 285fa8acbc Grammar: replaces 'indexes' by 'indices'
Grammar-nazi ran

git grep -l 'indexes' | xargs sed -i '' -e 's/indexes/indices/g'

to prevent future wincing when reading the source code.

Unfortunatly, Qt itself is infected as in
QModelIndexList QItemSelection::indexes() const

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2020-03-11 08:26:30 -07:00

32 lines
981 B
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef FILTERMODELS_H
#define FILTERMODELS_H
#include "divetripmodel.h"
#include <QSortFilterProxyModel>
#include <memory>
// This proxy model sits on top of either a DiveTripList or DiveTripTree model
// and does filtering and/or sorting.
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> &indices);
void currentDiveChanged(QModelIndex index);
private slots:
void selectionChangedSlot(const QVector<QModelIndex> &indices);
void currentDiveChangedSlot(QModelIndex index);
private:
MultiFilterSortModel(QObject *parent = 0);
std::unique_ptr<DiveTripModelBase> model;
};
#endif