subsurface/qt-models/filtermodels.h
Berthold Stoeger 908da77863 selection: rename selectionChanged() to divesSelected()
The signals/slot names for dive selection changes were a mess.
Unify on divesSelected(). Firstly, selectionChanged() is a Qt
thing. Secondly, it is consistent with tripSelected().

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2023-04-16 20:23:59 +02:00

31 lines
1.1 KiB
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);
signals:
void divesSelected(const QVector<QModelIndex> &indices, QModelIndex currentDive, int currentDC);
void tripSelected(QModelIndex trip, QModelIndex currentDive);
private slots:
void divesSelectedSlot(const QVector<QModelIndex> &indices, QModelIndex currentDive, int currentDC);
void tripSelectedSlot(QModelIndex trip, QModelIndex currentDive);
private:
MultiFilterSortModel(QObject *parent = 0);
std::unique_ptr<DiveTripModelBase> model;
};
#endif