JS8Call-Improved master
Loading...
Searching...
No Matches
CandidateKeyFilter.h
1#ifndef CANDIDATE_KEY_FILTER_HPP_
2#define CANDIDATE_KEY_FILTER_HPP_
3
4#include "JS8_Include/pimpl_h.h"
5
6#include <QModelIndex>
7#include <QSortFilterProxyModel>
8
9class QAbstractItemModel;
10
11class CandidateKeyFilter final : public QSortFilterProxyModel {
12 public:
13 explicit CandidateKeyFilter(QAbstractItemModel *referenced_model,
14 int referenced_key_column,
15 QObject *parent = nullptr,
16 int referenced_key_role = Qt::EditRole);
17 explicit CandidateKeyFilter(QAbstractItemModel *referenced_model,
18 QAbstractItemModel const *referencing_model,
19 int referenced_key_column,
20 int referencing_key_column,
21 QObject *parent = nullptr,
22 int referenced_key_role = Qt::EditRole,
23 int referencing_key_role = Qt::EditRole);
24 ~CandidateKeyFilter();
25
26 // this key is not to be filtered, usually because we want to allow
27 // it since we are editing the row that contains it this it is valid
28 // even though it is in use
29 void set_active_key(QModelIndex const &index = QModelIndex{});
30
31 protected:
32 bool filterAcceptsRow(int candidate_row,
33 QModelIndex const &candidate_parent) const override;
34
35 private:
36 class impl;
37 pimpl<impl> m_;
38};
39
40#endif
Definition CandidateKeyFilter.cpp:11
Definition pimpl_h.h:16