QAbstractItemModelReplica Class

The QAbstractItemModelReplica class serves as a convenience class for Replicas of Sources based on QAbstractItemModel . 更多...

头: #include <QAbstractItemModelReplica>
CMake: find_package(Qt6 REQUIRED COMPONENTS RemoteObjects)
target_link_libraries(mytarget PRIVATE Qt6::RemoteObjects)
qmake: QT += remoteobjects
继承: QAbstractItemModel

公共函数

virtual ~QAbstractItemModelReplica () override
QList<int> availableRoles () const
bool hasData (const QModelIndex & index , int role ) const
bool isInitialized () const
size_t rootCacheSize () const
QItemSelectionModel * selectionModel () const
void setRootCacheSize (size_t rootCacheSize )

重实现公共函数

virtual int columnCount (const QModelIndex & parent = QModelIndex()) const override
virtual QVariant data (const QModelIndex & index , int role = Qt::DisplayRole) const override
virtual Qt::ItemFlags flags (const QModelIndex & index ) const override
virtual bool hasChildren (const QModelIndex & parent = QModelIndex()) const override
virtual QVariant headerData (int section , Qt::Orientation orientation , int role ) const override
virtual QModelIndex index (int row , int column , const QModelIndex & parent = QModelIndex()) const override
virtual void multiData (const QModelIndex & index , QModelRoleDataSpan roleDataSpan ) const override
virtual QModelIndex parent (const QModelIndex & index ) const override
virtual QHash<int, QByteArray> roleNames () const override
virtual int rowCount (const QModelIndex & parent = QModelIndex()) const override
virtual bool setData (const QModelIndex & index , const QVariant & value , int role = Qt::EditRole) override

信号

void initialized ()

详细描述

QAbstractItemModelReplica makes replicating QAbstractItemModels more efficient by employing caching and pre-fetching.

另请参阅 QAbstractItemModel .

成员函数文档编制

[override virtual] QAbstractItemModelReplica:: ~QAbstractItemModelReplica ()

Destroys the instance of QAbstractItemModelReplica .

QList < int > QAbstractItemModelReplica:: availableRoles () const

Returns a list of available roles.

另请参阅 QAbstractItemModel .

[override virtual] int QAbstractItemModelReplica:: columnCount (const QModelIndex & parent = QModelIndex()) const

重实现: QAbstractItemModel::columnCount(const QModelIndex &parent) const .

[override virtual] QVariant QAbstractItemModelReplica:: data (const QModelIndex & index , int role = Qt::DisplayRole) const

重实现: QAbstractItemModel::data(const QModelIndex &index, int role) const .

返回 role 数据为项在 index if available in cache. A default-constructed QVariant is returned if the index is invalid, the role is not one of the available roles, the 复本 is uninitialized or the data was not available. If the data was not available in cache it will be requested from the .

另请参阅 QAbstractItemModel::data (), hasData (), setData (),和 isInitialized ().

[override virtual] Qt::ItemFlags QAbstractItemModelReplica:: flags (const QModelIndex & index ) const

重实现: QAbstractItemModel::flags(const QModelIndex &index) const .

[override virtual] bool QAbstractItemModelReplica:: hasChildren (const QModelIndex & parent = QModelIndex()) const

重实现: QAbstractItemModel::hasChildren(const QModelIndex &parent) const .

bool QAbstractItemModelReplica:: hasData (const QModelIndex & index , int role ) const

返回 true if there exists role 数据为项在 index 。返回 false in any other case.

[override virtual] QVariant QAbstractItemModelReplica:: headerData ( int section , Qt::Orientation orientation , int role ) const

重实现: QAbstractItemModel::headerData(int section, Qt::Orientation orientation, int role) const .

返回数据为给定 role and section 在 Header (头) 采用指定 orientation .

If the data is not available it will be requested from the .

另请参阅 QAbstractItemModel::headerData ().

[override virtual] QModelIndex QAbstractItemModelReplica:: index ( int row , int column , const QModelIndex & parent = QModelIndex()) const

重实现: QAbstractItemModel::index(int row, int column, const QModelIndex &parent) const .

[signal] void QAbstractItemModelReplica:: initialized ()

The initialized signal is emitted the first time we receive data from the .

另请参阅 isInitialized ().

bool QAbstractItemModelReplica:: isInitialized () const

返回 true 若此复本已初始化采用数据来自 对象。返回 false 否则。

另请参阅 initialized ().

[override virtual] void QAbstractItemModelReplica:: multiData (const QModelIndex & index , QModelRoleDataSpan roleDataSpan ) const

重实现: QAbstractItemModel::multiData(const QModelIndex &index, QModelRoleDataSpan roleDataSpan) const .

[override virtual] QModelIndex QAbstractItemModelReplica:: parent (const QModelIndex & index ) const

重实现: QAbstractItemModel::parent(const QModelIndex &index) const .

[override virtual] QHash < int , QByteArray > QAbstractItemModelReplica:: roleNames () const

重实现: QAbstractItemModel::roleNames() const .

size_t QAbstractItemModelReplica:: rootCacheSize () const

Returns the current size of the internal cache. By default this is set to the value of the QTRO_NODES_CACHE_SIZE environment variable, or a default of 1000 if it is invalid or doesn't exist.

另请参阅 setRootCacheSize ().

[override virtual] int QAbstractItemModelReplica:: rowCount (const QModelIndex & parent = QModelIndex()) const

重实现: QAbstractItemModel::rowCount(const QModelIndex &parent) const .

QItemSelectionModel *QAbstractItemModelReplica:: selectionModel () const

返回指针指向 QItemSelectionModel for the current QAbstractItemModelReplica .

[override virtual] bool QAbstractItemModelReplica:: setData (const QModelIndex & index , const QVariant & value , int role = Qt::EditRole)

重实现: QAbstractItemModel::setData (const QModelIndex &index, const QVariant &value, int role).

另请参阅 data ().

void QAbstractItemModelReplica:: setRootCacheSize ( size_t rootCacheSize )

Sets the size of the internal cache to rootCacheSize .

另请参阅 rootCacheSize ().