Wireshark  4.3.0
The Wireshark network protocol analyzer
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 
25 class CacheProxyModel : public QIdentityProxyModel
26 {
27  Q_OBJECT
28 
29 public:
30  CacheProxyModel(QObject *parent = 0);
31  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
32  Qt::ItemFlags flags(const QModelIndex &index) const;
33  QVariant headerData(int section, Qt::Orientation orientation,
34  int role = Qt::DisplayRole) const;
35  int rowCount(const QModelIndex &parent = QModelIndex()) const;
36  int columnCount(const QModelIndex &parent = QModelIndex()) const;
37  void setSourceModel(QAbstractItemModel *newSourceModel);
38 
39 private:
40  mutable QStandardItemModel cache;
41 
42  bool hasModel() const { return sourceModel() != &cache; }
43 
44 private slots:
45  void resetCacheModel();
46 };
47 #endif
Definition: cache_proxy_model.h:26
void setSourceModel(QAbstractItemModel *newSourceModel)
Definition: cache_proxy_model.cpp:81