mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
e46b1e88d9
The DiveListView caught signals from the DiveTripModel with the corresponding indexes. However, the DiveListView is actually connected to the MultiFilterSortModel and thus has to translate the indexes. Instead, catch the signals in the MultiFilterSortModel, transform them and resend. Let the DiveListView get its signal from the MultiFilterSortModel. Yes, this makes things less efficient because there is an extra signal. On the upside, the makes data-flow much more logical. Selection will have to be fixed anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
27 lines
788 B
C++
27 lines
788 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);
|
|
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
|