QProxyModel

Synopsis

Functions

Virtual functions

Detailed Description

The PySide.QtGui.QProxyModel class provides support for processing data passed between another model and a view.

If you want to do filtering and sorting, see PySide.QtGui.QSortFilterProxyModel .

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 of PySide.QtGui.QAbstractItemView , PySide.QtGui.QProxyModel provides the PySide.QtGui.QProxyModel.setModel() 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 with QAbstractItemView.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 also

Model/View Programming PySide.QtCore.QAbstractItemModel

class PySide.QtGui.QProxyModel([parent=None])
Parameters:parentPySide.QtCore.QObject

Constructs a proxy model with the given parent .

PySide.QtGui.QProxyModel.connectToModel(model)
Parameters:modelPySide.QtCore.QAbstractItemModel

Connect to all the signals emitted by given model .

PySide.QtGui.QProxyModel.disconnectFromModel(model)
Parameters:modelPySide.QtCore.QAbstractItemModel

Disconnect from all the signals emitted by the given model .

PySide.QtGui.QProxyModel.model()
Return type:PySide.QtCore.QAbstractItemModel

Returns the model that contains the data that is available through the proxy model.

PySide.QtGui.QProxyModel.setModel(model)
Parameters:modelPySide.QtCore.QAbstractItemModel

Sets the given model to be processed by the proxy model.

PySide.QtGui.QProxyModel.setProxyModel(source_index)
Parameters:source_indexPySide.QtCore.QModelIndex
Return type:PySide.QtCore.QModelIndex

Change the model pointer in the given source_index to point to the proxy model.

PySide.QtGui.QProxyModel.setSourceModel(proxy_index)
Parameters:proxy_indexPySide.QtCore.QModelIndex
Return type:PySide.QtCore.QModelIndex

Change the model pointer in the given proxy_index to point to the source model.