Wireshark 2.9.0-477-g68ec514b The Wireshark network protocol analyzer

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

astringlist_list_model.h
1 /* astringlist_list_model.h
2 *
3 * Wireshark - Network traffic analyzer
4 * By Gerald Combs <gerald@wireshark.org>
5 * Copyright 1998 Gerald Combs
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10 #ifndef ASTRINGLIST_LIST_MODEL_H
11 #define ASTRINGLIST_LIST_MODEL_H
12
13 #include <config.h>
14
15 #include <QAbstractTableModel>
16 #include <QModelIndex>
17 #include <QList>
18 #include <QStringList>
19 #include <QSortFilterProxyModel>
20 #include <QIdentityProxyModel>
21
22 class AStringListListModel : public QAbstractTableModel
23 {
24 Q_OBJECT
25
26 public:
27 explicit AStringListListModel(QObject * parent = Q_NULLPTR);
28 virtual ~AStringListListModel();
29
30 virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
31 virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
32 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
33 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
34
35 protected:
36 virtual void appendRow(const QStringList &, const QString & row_tooltip = QString(), const QModelIndex &parent = QModelIndex());
37
38 virtual QStringList headerColumns() const = 0;
39
40 private:
41 QList<QStringList> display_data_;
42 QStringList tooltip_data_;
43 };
44
45 class AStringListListSortFilterProxyModel : public QSortFilterProxyModel
46 {
47 Q_OBJECT
48 public:
49
50 enum AStringListListFilterType
51 {
52 FilterByContains = 0,
53 FilterByStart = 1
54 };
55
56 explicit AStringListListSortFilterProxyModel(QObject * parent = Q_NULLPTR);
57
58 virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
59 virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
60
61 void setFilterType(AStringListListFilterType type);
62
63 void setColumnToFilter(int);
64 void clearColumnsToFilter();
65
66 public slots:
67 void setFilter(const QString&);
68
69 private:
70
71 QString filter_;
72 AStringListListFilterType type_;
73 QList<int> columnsToFilter_;
74 };
75
76 class AStringListListUrlProxyModel : public QIdentityProxyModel
77 {
78 Q_OBJECT
79 public:
80 explicit AStringListListUrlProxyModel(QObject * parent = Q_NULLPTR);
81
82 void setUrlColumn(int);
83 bool isUrlColumn(int) const;
84
85 virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
86
87 private:
88 QList<int> urls_;
89 };
90
91 #endif // ASTRINGLIST_LIST_MODEL_H
92
93 /*
94 * Editor modelines
95 *
96 * Local Variables:
97 * c-basic-offset: 4
98 * tab-width: 8
99 * indent-tabs-mode: nil
100 * End:
101 *
102 * ex: set shiftwidth=4 tabstop=8 expandtab:
103 * :indentSize=4:tabSize=8:noTabs=true:
104 */
AStringListListUrlProxyModel
Definition: astringlist_list_model.h:76
AStringListListModel
Definition: astringlist_list_model.h:22
AStringListListSortFilterProxyModel
Definition: astringlist_list_model.h:45