Wireshark 4.7.3
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
cache_proxy_model.h
Go to the documentation of this file.
1
9
10#ifndef CACHE_PROXY_MODEL_H
11#define CACHE_PROXY_MODEL_H
12
13#include <config.h>
14
15#include <QIdentityProxyModel>
16#include <QStandardItemModel>
17
25class CacheProxyModel : public QIdentityProxyModel
26{
27 Q_OBJECT
28
29public:
34 CacheProxyModel(QObject *parent = 0);
35
42 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
43
49 Qt::ItemFlags flags(const QModelIndex &index) const override;
50
58 QVariant headerData(int section, Qt::Orientation orientation,
59 int role = Qt::DisplayRole) const override;
60
66 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
67
73 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
74
79 void setSourceModel(QAbstractItemModel *newSourceModel) override;
80
81private:
83 mutable QStandardItemModel cache;
84
89 bool hasModel() const { return sourceModel() != &cache; }
90
91private slots:
95 void resetCacheModel();
96};
97#endif
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Retrieves the header data for a given section, orientation, and role.
Definition cache_proxy_model.cpp:43
void setSourceModel(QAbstractItemModel *newSourceModel) override
Sets a new source model to be cached and proxied.
Definition cache_proxy_model.cpp:81
CacheProxyModel(QObject *parent=0)
Constructs a new CacheProxyModel.
Definition cache_proxy_model.cpp:12
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
Definition cache_proxy_model.cpp:55
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns under the given parent.
Definition cache_proxy_model.cpp:66
Qt::ItemFlags flags(const QModelIndex &index) const override
Retrieves the item flags for the given index.
Definition cache_proxy_model.cpp:33
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Retrieves data from the model for the given index and role.
Definition cache_proxy_model.cpp:16