This mixin class provides access to source model attributes and methods.
The following example illustrates usage on a custom model:
class SortModel(QSortFilterProxyModel, HideProxyMixin):
pass
mdata = QStandardItemModel()
msort = SortModel()
msort.setSourceModel(mdata)
This makes the following two calls identical:
item = msort.itemFromIndex(proxyindex)
item = msort.sourceModel().itemFromIndex(msort.mapToSource(proxyindex))
Arguments and return values may be converted if required, e.g. mapping of model indexes. The conversions used are based on annotations in the source model, which should be one of 'row', 'column' or 'index'. The conversions are done by methods in the proxy model, mapRowFromSource, mapColumnFromSource, PySide.QtGui.~QAbstractProxyModel.mapFromSource and the corresponding ToSource methods. PySide.QtGui.QAbstractProxyModel.mapToSource and PySide.QtGui.QAbstractProxyModel.mapFromSource are defined by PySide. The others are proxided by the mixin, but may be re-implemented.
Note
Annotations are not supported in Python 2, but can be set explicitly using, for example rowCount.__annotations__ = {'parent': 'index'}.
SortFilterProxyModel and AppendProxyModel use this mixin.
Map a column from the source model.
This simply calls PySide.QtGui.QAbstractProxyModel.mapFromSource with an index in row 0, and should be re-implemented when a more direct method can be used.
Map a column to the source model.
This simply calls PySide.QtGui.QAbstractProxyModel.mapToSource with an index in row 0, and should be re-implemented when a more direct method can be used.
Map a row from the source model.
This simply calls PySide.QtGui.QAbstractProxyModel.mapFromSource with an index in column 0, and should be re-implemented when a more direct method can be used.
Map a row to the source model.
This simply calls PySide.QtGui.QAbstractProxyModel.mapToSource with an index in column 0, and should be re-implemented when a more direct method can be used.