-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcmysortfilterproxymodel.h
More file actions
39 lines (33 loc) · 1004 Bytes
/
cmysortfilterproxymodel.h
File metadata and controls
39 lines (33 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef CMYSORTFILTERPROXYMODEL_H
#define CMYSORTFILTERPROXYMODEL_H
#include <QSortFilterProxyModel>
#include <QObject>
class CMySortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit CMySortFilterProxyModel(QObject *parent = nullptr);
~CMySortFilterProxyModel() {};
void setFilter(int column, QString oper, QString value);
void clearFilter();
enum HeaderTitle {
seqNo = 0,
time,
srcMac,
dstMac,
proto,
subProto,
length,
info,
end = info
};
protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
private:
// 以列为key的字典,值为具体条件
QMap <int, QString> m_filterValue;
// 以列为key的操作符字典,取值范围:> < >= <= == !=
QMap <int, QString> m_filterOper;
};
#endif // CMYSORTFILTERPROXYMODEL_H