Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
cache_proxy_model.h
Go to the documentation of this file.
1
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;
43
49 Qt::ItemFlags flags(const QModelIndex &index) const;
50
58 QVariant headerData(int section, Qt::Orientation orientation,
59 int role = Qt::DisplayRole) const;
60
66 int rowCount(const QModelIndex &parent = QModelIndex()) const;
67
73 int columnCount(const QModelIndex &parent = QModelIndex()) const;
74
79 void setSourceModel(QAbstractItemModel *newSourceModel);
80
81private:
83 mutable QStandardItemModel cache;
84
89 bool hasModel() const { return sourceModel() != &cache; }
90
91private slots:
95 void resetCacheModel();
96};
97#endif
Caches any data read access to the source model, returning an older copy if the source model is inval...
Definition cache_proxy_model.h:26
int columnCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of columns under the given parent.
Definition cache_proxy_model.cpp:66
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Retrieves data from the model for the given index and role.
Definition cache_proxy_model.cpp:16
void setSourceModel(QAbstractItemModel *newSourceModel)
Sets a new source model to be cached and proxied.
Definition cache_proxy_model.cpp:81
Qt::ItemFlags flags(const QModelIndex &index) const
Retrieves the item flags for the given index.
Definition cache_proxy_model.cpp:33
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Retrieves the header data for a given section, orientation, and role.
Definition cache_proxy_model.cpp:43
int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of rows under the given parent.
Definition cache_proxy_model.cpp:55