Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Public Member Functions | List of all members
CacheProxyModel Class Reference

Caches any data read access to the source model, returning an older copy if the source model is invalidated. More...

#include <cache_proxy_model.h>

Inheritance diagram for CacheProxyModel:

Public Member Functions

 CacheProxyModel (QObject *parent=0)
 Constructs a new CacheProxyModel.
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
 Retrieves data from the model for the given index and role.
 
Qt::ItemFlags flags (const QModelIndex &index) const
 Retrieves the item flags for the given index.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 Retrieves the header data for a given section, orientation, and role.
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 Returns the number of rows under the given parent.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 Returns the number of columns under the given parent.
 
void setSourceModel (QAbstractItemModel *newSourceModel)
 Sets a new source model to be cached and proxied.
 

Detailed Description

Caches any data read access to the source model, returning an older copy if the source model is invalidated.

Only flat data is supported at the moment, tree models (with parents) are unsupported.

Constructor & Destructor Documentation

◆ CacheProxyModel()

CacheProxyModel::CacheProxyModel ( QObject *  parent = 0)

Constructs a new CacheProxyModel.

Parameters
parentThe parent QObject, defaults to 0.

Member Function Documentation

◆ columnCount()

int CacheProxyModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const

Returns the number of columns under the given parent.

Parameters
parentThe parent model index (defaults to an invalid QModelIndex).
Returns
The number of columns in the model or cache.

◆ data()

QVariant CacheProxyModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const

Retrieves data from the model for the given index and role.

Parameters
indexThe model index to retrieve data for.
roleThe role for which the data is requested (defaults to Qt::DisplayRole).
Returns
The data associated with the index and role, returning cached data if the source is invalid.

◆ flags()

Qt::ItemFlags CacheProxyModel::flags ( const QModelIndex &  index) const

Retrieves the item flags for the given index.

Parameters
indexThe model index to query.
Returns
The item flags for the specified index.

◆ headerData()

QVariant CacheProxyModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

Retrieves the header data for a given section, orientation, and role.

Parameters
sectionThe section (column or row) to retrieve data for.
orientationThe orientation of the header.
roleThe role for which the data is requested (defaults to Qt::DisplayRole).
Returns
The header data for the specified parameters.

◆ rowCount()

int CacheProxyModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const

Returns the number of rows under the given parent.

Parameters
parentThe parent model index (defaults to an invalid QModelIndex).
Returns
The number of rows in the model or cache.

◆ setSourceModel()

void CacheProxyModel::setSourceModel ( QAbstractItemModel *  newSourceModel)

Sets a new source model to be cached and proxied.

Parameters
newSourceModelA pointer to the new source model.

Sets the source model from which data must be pulled. If newSourceModel is NULL, then the cache will be used.


The documentation for this class was generated from the following files: