Wireshark  2.9.0-477-g68ec514b
The Wireshark network protocol analyzer
cache_proxy_model.h
1 /* cache_proxy_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 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:25
void setSourceModel(QAbstractItemModel *newSourceModel)
Definition: cache_proxy_model.cpp:81