Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QIdentityProxyModel Class

TheQIdentityProxyModel class proxies its source model unmodifiedMore...

Header:#include <QIdentityProxyModel>
Since: Qt 4.8
Inherits:QAbstractProxyModel

Public Functions

Reimplemented Public Functions

virtual intcolumnCount(const QModelIndex & parent = QModelIndex()) const
virtual booldropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent)
virtual QModelIndexindex(int row, int column, const QModelIndex & parent = QModelIndex()) const
virtual boolinsertColumns(int column, int count, const QModelIndex & parent = QModelIndex())
virtual boolinsertRows(int row, int count, const QModelIndex & parent = QModelIndex())
virtual QModelIndexmapFromSource(const QModelIndex & sourceIndex) const
virtual QItemSelectionmapSelectionFromSource(const QItemSelection & selection) const
virtual QItemSelectionmapSelectionToSource(const QItemSelection & selection) const
virtual QModelIndexmapToSource(const QModelIndex & proxyIndex) const
virtual QModelIndexListmatch(const QModelIndex & start, int role, const QVariant & value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap )) const
virtual QModelIndexparent(const QModelIndex & child) const
virtual boolremoveColumns(int column, int count, const QModelIndex & parent = QModelIndex())
virtual boolremoveRows(int row, int count, const QModelIndex & parent = QModelIndex())
virtual introwCount(const QModelIndex & parent = QModelIndex()) const
virtual voidsetSourceModel(QAbstractItemModel * newSourceModel)

Additional Inherited Members

Detailed Description

TheQIdentityProxyModel class proxies its source model unmodified

QIdentityProxyModel can be used to forward the structure of a source model exactly, with no sorting, filtering or other transformation. This is similar in concept to an identity matrix where A.I = A.

Because it does no sorting or filtering, this class is most suitable to proxy models which transform thedata() of the source model. For example, a proxy model could be created to define the font used, or the background colour, or the tooltip etc. This removes the need to implement all data handling in the same class that creates the structure of the model, and can also be used to create re-usable components.

This also provides a way to change the data in the case where a source model is supplied by a third party which can not be modified.

class DateFormatProxyModel :publicQIdentityProxyModel{// ...void setDateFormatString(constQString&formatString)  {    m_formatString= formatString;  }QVariant data(constQModelIndex&index,int role)  {if (role!=Qt::DisplayRole)returnQIdentityProxyModel::data(index, role);constQDateTime dateTime= sourceModel()->data(SourceClass::DateRole).toDateTime();return dateTime.toString(m_formatString);  }private:QString m_formatString;};

See alsoQAbstractProxyModel,Model/View Programming, andQAbstractItemModel.

Member Function Documentation

QIdentityProxyModel::QIdentityProxyModel(QObject * parent = 0)

Constructs an identity model with the givenparent.

QIdentityProxyModel::~QIdentityProxyModel()

Destroys this identity model.

[virtual]int QIdentityProxyModel::columnCount(constQModelIndex & parent = QModelIndex()) const

Reimplemented fromQAbstractItemModel::columnCount().

[virtual]bool QIdentityProxyModel::dropMimeData(constQMimeData * data,Qt::DropAction action,int row,int column, constQModelIndex & parent)

Reimplemented fromQAbstractItemModel::dropMimeData().

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

Reimplemented fromQAbstractItemModel::index().

[virtual]bool QIdentityProxyModel::insertColumns(int column,int count, constQModelIndex & parent = QModelIndex())

Reimplemented fromQAbstractItemModel::insertColumns().

[virtual]bool QIdentityProxyModel::insertRows(int row,int count, constQModelIndex & parent = QModelIndex())

Reimplemented fromQAbstractItemModel::insertRows().

[virtual]QModelIndex QIdentityProxyModel::mapFromSource(constQModelIndex & sourceIndex) const

Reimplemented fromQAbstractProxyModel::mapFromSource().

[virtual]QItemSelection QIdentityProxyModel::mapSelectionFromSource(constQItemSelection & selection) const

Reimplemented fromQAbstractProxyModel::mapSelectionFromSource().

[virtual]QItemSelection QIdentityProxyModel::mapSelectionToSource(constQItemSelection & selection) const

Reimplemented fromQAbstractProxyModel::mapSelectionToSource().

[virtual]QModelIndex QIdentityProxyModel::mapToSource(constQModelIndex & proxyIndex) const

Reimplemented fromQAbstractProxyModel::mapToSource().

[virtual]QModelIndexList QIdentityProxyModel::match(constQModelIndex & start,int role, constQVariant & value,int hits = 1,Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap )) const

Reimplemented fromQAbstractItemModel::match().

[virtual]QModelIndex QIdentityProxyModel::parent(constQModelIndex & child) const

Reimplemented fromQAbstractItemModel::parent().

[virtual]bool QIdentityProxyModel::removeColumns(int column,int count, constQModelIndex & parent = QModelIndex())

Reimplemented fromQAbstractItemModel::removeColumns().

[virtual]bool QIdentityProxyModel::removeRows(int row,int count, constQModelIndex & parent = QModelIndex())

Reimplemented fromQAbstractItemModel::removeRows().

[virtual]int QIdentityProxyModel::rowCount(constQModelIndex & parent = QModelIndex()) const

Reimplemented fromQAbstractItemModel::rowCount().

[virtual]void QIdentityProxyModel::setSourceModel(QAbstractItemModel * newSourceModel)

Reimplemented fromQAbstractProxyModel::setSourceModel().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp