-
Notifications
You must be signed in to change notification settings - Fork 208
/
rytablesortfilterproxymodel.h
56 lines (43 loc) · 1.39 KB
/
rytablesortfilterproxymodel.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef RYTABLESORTFILTERPROXYMODEL_H
#define RYTABLESORTFILTERPROXYMODEL_H
#include <QSortFilterProxyModel>
#include <rytablemodel.h>
class RyTableSortFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
typedef bool (*FilterCallBack)(RyPipeData_ptr);
enum Filter{
NoFilter = 0,
NoImageFilter = 0x01,
No304Filter = 0x02,
CustomFilter = 0x04,
OnlyMatchingFilter = 0x08,
HideTunnelFilter = 0x10
};
explicit RyTableSortFilterProxyModel(QObject *parent = 0);
void setSourceModel(QAbstractItemModel *sourceModel);
RyTableModel *sourceModel()const;
RyPipeData_ptr getItem(int sourceRow);
RyPipeData_ptr getItem(const QModelIndex& proxyIndex);
void setFilterText(QString filterText);
void setFilter(int filter);
int filter()const;
void setCustomeFilter(FilterCallBack);
void removeAllItem();
void updateItem(RyPipeData_ptr);
void addItem(RyPipeData_ptr);
void setMaxRequestSize(int maxSize);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
signals:
public slots:
private:
RyTableModel *_sourceModel;
QString _filterText;
int _filterFlags;
FilterCallBack _filterCallback;
QMutex _filterFlagMutex;
};
#endif // RYTABLESORTFILTERPROXYMODEL_H