
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQProxyModel class provides support for processing data passed between another model and a view.More...
| Header: | #include <QProxyModel> |
| Inherits: | QAbstractItemModel |
This class is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
| QProxyModel(QObject * parent = 0) | |
| ~QProxyModel() | |
| QAbstractItemModel * | model() const |
| virtual void | setModel(QAbstractItemModel * model) |
| virtual int | columnCount(const QModelIndex & parent = QModelIndex()) const |
| virtual QVariant | data(const QModelIndex & index, int role = Qt::DisplayRole) const |
| virtual bool | dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent) |
| virtual void | fetchMore(const QModelIndex & parent) |
| virtual Qt::ItemFlags | flags(const QModelIndex & index) const |
| virtual bool | hasChildren(const QModelIndex & parent = QModelIndex()) const |
| virtual QVariant | headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const |
| virtual QModelIndex | index(int row, int column, const QModelIndex & parent = QModelIndex()) const |
| virtual bool | insertColumns(int column, int count, const QModelIndex & parent = QModelIndex()) |
| virtual bool | insertRows(int row, int count, const QModelIndex & parent = QModelIndex()) |
| virtual QModelIndexList | match(const QModelIndex & start, int role, const QVariant & value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap )) const |
| virtual QMimeData * | mimeData(const QModelIndexList & indexes) const |
| virtual QStringList | mimeTypes() const |
| virtual QModelIndex | parent(const QModelIndex & child) const |
| virtual void | revert() |
| virtual int | rowCount(const QModelIndex & parent = QModelIndex()) const |
| virtual bool | setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole) |
| virtual bool | setHeaderData(int section, Qt::Orientation orientation, const QVariant & value, int role = Qt::EditRole) |
| virtual void | sort(int column, Qt::SortOrder order = Qt::AscendingOrder) |
| virtual QSize | span(const QModelIndex & index) const |
| virtual bool | submit() |
| virtual Qt::DropActions | supportedDropActions() const |
TheQProxyModel class provides support for processing data passed between another model and a view.
If you want to do filtering and sorting, seeQSortFilterProxyModel.
Proxy models provide a standard model interface that can be used to manipulate the data retrieved through an underlying model. They can be used to perform operations such as sorting and filtering on the data obtained without changing the contents of the model.
Just as with subclasses ofQAbstractItemView,QProxyModel provides thesetModel() function that is used to specify the model to be acted on by the proxy. Views can be connected to either the underlying model or the proxy model withQAbstractItemView::setModel().
Since views rely on the information provided in model indexes to identify items of data from models, and to position these items in some visual representation, proxy models must create their own model indexes instead of supplying model indexes from their underlying models.
See alsoModel/View Programming andQAbstractItemModel.
Constructs a proxy model with the givenparent.
Destroys the proxy model.
[virtual]int QProxyModel::columnCount(constQModelIndex & parent = QModelIndex()) constReimplemented fromQAbstractItemModel::columnCount().
Returns the number of columns for the givenparent.
See alsoQAbstractItemModel::columnCount().
[virtual]QVariant QProxyModel::data(constQModelIndex & index,int role = Qt::DisplayRole) constReimplemented fromQAbstractItemModel::data().
Returns the data stored in the item with the givenindex under the specifiedrole.
See alsosetData().
[virtual]bool QProxyModel::dropMimeData(constQMimeData * data,Qt::DropAction action,int row,int column, constQModelIndex & parent)Reimplemented fromQAbstractItemModel::dropMimeData().
Returns true if the model accepts thedata dropped onto an attached view for the specifiedaction; otherwise returns false.
Theparent,row, andcolumn details can be used to control which MIME types are acceptable to different parts of a model when received via the drag and drop system.
[virtual]void QProxyModel::fetchMore(constQModelIndex & parent)Reimplemented fromQAbstractItemModel::fetchMore().
Fetches more child items of the givenparent. This function is used by views to tell the model that they can display more data than the model has provided.
See alsoQAbstractItemModel::fetchMore().
[virtual]Qt::ItemFlags QProxyModel::flags(constQModelIndex & index) constReimplemented fromQAbstractItemModel::flags().
Returns the item flags for the givenindex.
[virtual]bool QProxyModel::hasChildren(constQModelIndex & parent = QModelIndex()) constReimplemented fromQAbstractItemModel::hasChildren().
Returns true if the item corresponding to theparent index has child items; otherwise returns false.
See alsoQAbstractItemModel::hasChildren().
[virtual]QVariant QProxyModel::headerData(int section,Qt::Orientation orientation,int role = Qt::DisplayRole) constReimplemented fromQAbstractItemModel::headerData().
Returns the data stored in thesection of the header with specifiedorientation under the givenrole.
See alsosetHeaderData().
[virtual]QModelIndex QProxyModel::index(int row,int column, constQModelIndex & parent = QModelIndex()) constReimplemented fromQAbstractItemModel::index().
Returns the model index with the givenrow,column, andparent.
See alsoQAbstractItemModel::index().
[virtual]bool QProxyModel::insertColumns(int column,int count, constQModelIndex & parent = QModelIndex())Reimplemented fromQAbstractItemModel::insertColumns().
Insertscount columns into the model, creating new items as children of the givenparent. The new columns are inserted before thecolumn specified. If theparent item has no children, a single row is created to contain the required number of columns.
Returns true if the columns were successfully inserted; otherwise returns false.
See alsoQAbstractItemModel::insertColumns().
[virtual]bool QProxyModel::insertRows(int row,int count, constQModelIndex & parent = QModelIndex())Reimplemented fromQAbstractItemModel::insertRows().
Insertscount rows into the model, creating new items as children of the givenparent. The new rows are inserted before therow specified. If theparent item has no children, a single column is created to contain the required number of rows.
Returns true if the rows were successfully inserted; otherwise returns false.
See alsoQAbstractItemModel::insertRows().
[virtual]QModelIndexList QProxyModel::match(constQModelIndex & start,int role, constQVariant & value,int hits = 1,Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap )) constReimplemented fromQAbstractItemModel::match().
Returns a list of model indexes that each contain the givenvalue for therole specified. The search begins at thestart index and is performed according to the specifiedflags. The search continues until the number of matching data items equalshits, the last row is reached, or the search reachesstart again, depending on whetherMatchWrap is specified inflags.
See alsoQAbstractItemModel::match().
[virtual]QMimeData * QProxyModel::mimeData(constQModelIndexList & indexes) constReimplemented fromQAbstractItemModel::mimeData().
Returns MIME data for the specifiedindexes in the model.
[virtual]QStringList QProxyModel::mimeTypes() constReimplemented fromQAbstractItemModel::mimeTypes().
Returns a list of MIME types that are supported by the model.
Returns the model that contains the data that is available through the proxy model.
See alsosetModel().
[virtual]QModelIndex QProxyModel::parent(constQModelIndex & child) constReimplemented fromQAbstractItemModel::parent().
Returns the model index that corresponds to the parent of the givenchild index.
[virtual]void QProxyModel::revert()Reimplemented fromQAbstractItemModel::revert().
[virtual]int QProxyModel::rowCount(constQModelIndex & parent = QModelIndex()) constReimplemented fromQAbstractItemModel::rowCount().
Returns the number of rows for the givenparent.
See alsoQAbstractItemModel::rowCount().
[virtual]bool QProxyModel::setData(constQModelIndex & index, constQVariant & value,int role = Qt::EditRole)Reimplemented fromQAbstractItemModel::setData().
Sets therole data for the item atindex tovalue. Returns true if successful; otherwise returns false.
The base class implementation returns false. This function anddata() must be reimplemented for editable models.
See alsodata(),itemData(), andQAbstractItemModel::setData().
[virtual]bool QProxyModel::setHeaderData(int section,Qt::Orientation orientation, constQVariant & value,int role = Qt::EditRole)Reimplemented fromQAbstractItemModel::setHeaderData().
Sets therole data in thesection of the header with the specifiedorientation to thevalue given.
See alsoheaderData() andQAbstractItemModel::setHeaderData().
[virtual]void QProxyModel::setModel(QAbstractItemModel * model)Sets the givenmodel to be processed by the proxy model.
See alsomodel().
[virtual]void QProxyModel::sort(int column,Qt::SortOrder order = Qt::AscendingOrder)Reimplemented fromQAbstractItemModel::sort().
Sorts the child items in the specifiedcolumn according to the sort order defined byorder.
See alsoQAbstractItemModel::sort().
[virtual]QSize QProxyModel::span(constQModelIndex & index) constReimplemented fromQAbstractItemModel::span().
Returns the size of the item that corresponds to the specifiedindex.
[virtual]bool QProxyModel::submit()Reimplemented fromQAbstractItemModel::submit().
[virtual]Qt::DropActions QProxyModel::supportedDropActions() constReimplemented fromQAbstractItemModel::supportedDropActions().
Returns the drop actions that are supported by the model; this is a combination of the individual actions defined inQt::DropActions.
The selection of drop actions provided by the model will influence the behavior of the component that started the drag and drop operation.
See alsoDrag and Drop.
© 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.