<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QAbstractProxyModel Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QAbstractProxyModel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QAbstractProxyModel class provides a base class for proxy item models that can do sorting, filtering or other data processing tasks. <a href="#details">More...</a></p> <p>Inherits <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p><p>Inherited by <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractproxymodel.html#QAbstractProxyModel">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />QVariant <b><a href="qabstractproxymodel.html#data">data</a></b> (<i>self</i>, QModelIndex, int <i>role</i> = Qt.DisplayRole)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qabstractproxymodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />QVariant <b><a href="qabstractproxymodel.html#headerData">headerData</a></b> (<i>self</i>, int, Qt.Orientation, int)</li><li><div class="fn" />dict-of-int-QVariant <b><a href="qabstractproxymodel.html#itemData">itemData</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />QModelIndex <b><a href="qabstractproxymodel.html#mapFromSource">mapFromSource</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />QItemSelection <b><a href="qabstractproxymodel.html#mapSelectionFromSource">mapSelectionFromSource</a></b> (<i>self</i>, QItemSelection)</li><li><div class="fn" />QItemSelection <b><a href="qabstractproxymodel.html#mapSelectionToSource">mapSelectionToSource</a></b> (<i>self</i>, QItemSelection)</li><li><div class="fn" />QModelIndex <b><a href="qabstractproxymodel.html#mapToSource">mapToSource</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractproxymodel.html#revert">revert</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractproxymodel.html#setData">setData</a></b> (<i>self</i>, QModelIndex, QVariant, int <i>role</i> = Qt.EditRole)</li><li><div class="fn" />bool <b><a href="qabstractproxymodel.html#setHeaderData">setHeaderData</a></b> (<i>self</i>, int, Qt.Orientation, QVariant, int <i>role</i> = Qt.EditRole)</li><li><div class="fn" /><b><a href="qabstractproxymodel.html#setSourceModel">setSourceModel</a></b> (<i>self</i>, QAbstractItemModel)</li><li><div class="fn" />QAbstractItemModel <b><a href="qabstractproxymodel.html#sourceModel">sourceModel</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractproxymodel.html#submit">submit</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractProxyModel class provides a base class for proxy item models that can do sorting, filtering or other data processing tasks.</p> <p>This class defines the standard interface that proxy models must use to be able to interoperate correctly with other model/view components. It is not supposed to be instantiated directly.</p> <p>All standard proxy models are derived from the QAbstractProxyModel class. If you need to create a new proxy model class, it is usually better to subclass an existing class that provides the closest behavior to the one you want to provide.</p> <p>Proxy models that filter or sort items of data from a source model should be created by using or subclassing <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a>.</p> <p>To subclass QAbstractProxyModel, you need to implement <a href="qabstractproxymodel.html#mapFromSource">mapFromSource</a>() and <a href="qabstractproxymodel.html#mapToSource">mapToSource</a>(). The <a href="qabstractproxymodel.html#mapSelectionFromSource">mapSelectionFromSource</a>() and <a href="qabstractproxymodel.html#mapSelectionToSource">mapSelectionToSource</a>() functions only need to be reimplemented if you need a behavior different from the default behavior.</p> <p><b>Note:</b> If the source model is deleted or no source model is specified, the proxy model operates on a empty placeholder model.</p> <p>See also <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>, and <a href="model-view-programming.html">Model/View Programming</a>.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractProxyModel" />QAbstractProxyModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a proxy model with the given <i>parent</i>.</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/~QAbstractProxyModel" /> <h3 class="fn"><a name="data" />QVariant QAbstractProxyModel.data (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int <i>role</i> = Qt.DisplayRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#data">QAbstractItemModel.data</a>().</p> <p>See also <a href="qabstractproxymodel.html#setData">setData</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/flags" /> <h3 class="fn"><a name="flags" /><a href="qt-itemflags.html">Qt.ItemFlags</a> QAbstractProxyModel.flags (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#flags">QAbstractItemModel.flags</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/headerData" /> <h3 class="fn"><a name="headerData" />QVariant QAbstractProxyModel.headerData (<i>self</i>, int, <a href="qt.html#Orientation-enum">Qt.Orientation</a>, int)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#headerData">QAbstractItemModel.headerData</a>().</p> <p>See also <a href="qabstractproxymodel.html#setHeaderData">setHeaderData</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/itemData" /> <h3 class="fn"><a name="itemData" />dict-of-int-QVariant QAbstractProxyModel.itemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#itemData">QAbstractItemModel.itemData</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/mapFromSource" /> <h3 class="fn"><a name="mapFromSource" /><a href="qmodelindex.html">QModelIndex</a> QAbstractProxyModel.mapFromSource (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Reimplement this function to return the model index in the proxy model that corresponds to the <i>sourceIndex</i> from the source model.</p> <p>See also <a href="qabstractproxymodel.html#mapToSource">mapToSource</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/mapSelectionFromSource" /> <h3 class="fn"><a name="mapSelectionFromSource" /><a href="qitemselection.html">QItemSelection</a> QAbstractProxyModel.mapSelectionFromSource (<i>self</i>, <a href="qitemselection.html">QItemSelection</a>)</h3><p>Returns a proxy selection mapped from the specified <i>sourceSelection</i>.</p> <p>Reimplement this method to map source selections to proxy selections.</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/mapSelectionToSource" /> <h3 class="fn"><a name="mapSelectionToSource" /><a href="qitemselection.html">QItemSelection</a> QAbstractProxyModel.mapSelectionToSource (<i>self</i>, <a href="qitemselection.html">QItemSelection</a>)</h3><p>Returns a source selection mapped from the specified <i>proxySelection</i>.</p> <p>Reimplement this method to map proxy selections to source selections.</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/mapToSource" /> <h3 class="fn"><a name="mapToSource" /><a href="qmodelindex.html">QModelIndex</a> QAbstractProxyModel.mapToSource (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Reimplement this function to return the model index in the source model that corresponds to the <i>proxyIndex</i> in the proxy model.</p> <p>See also <a href="qabstractproxymodel.html#mapFromSource">mapFromSource</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/revert" /> <h3 class="fn"><a name="revert" />QAbstractProxyModel.revert (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#revert">QAbstractItemModel.revert</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/setData" /> <h3 class="fn"><a name="setData" />bool QAbstractProxyModel.setData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, QVariant, int <i>role</i> = Qt.EditRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#setData">QAbstractItemModel.setData</a>().</p> <p>See also <a href="qabstractproxymodel.html#data">data</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/setHeaderData" /> <h3 class="fn"><a name="setHeaderData" />bool QAbstractProxyModel.setHeaderData (<i>self</i>, int, <a href="qt.html#Orientation-enum">Qt.Orientation</a>, QVariant, int <i>role</i> = Qt.EditRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#setHeaderData">QAbstractItemModel.setHeaderData</a>().</p> <p>See also <a href="qabstractproxymodel.html#headerData">headerData</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/setSourceModel" /> <h3 class="fn"><a name="setSourceModel" />QAbstractProxyModel.setSourceModel (<i>self</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>)</h3><p>Sets the given <i>sourceModel</i> to be processed by the proxy model.</p> <p>See also <a href="qabstractproxymodel.html#sourceModel">sourceModel</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/sourceModel" /> <h3 class="fn"><a name="sourceModel" /><a href="qabstractitemmodel.html">QAbstractItemModel</a> QAbstractProxyModel.sourceModel (<i>self</i>)</h3><p>Returns the model that contains the data that is available through the proxy model.</p> <p>See also <a href="qabstractproxymodel.html#setSourceModel">setSourceModel</a>().</p> <a name="//apple_ref/cpp/instm/QAbstractProxyModel/submit" /> <h3 class="fn"><a name="submit" />bool QAbstractProxyModel.submit (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#submit">QAbstractItemModel.submit</a>().</p> <p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.7.4 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt 4.6.3</td></tr></table></div></address></body></html>