<?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>QProxyModel 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="index.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">QProxyModel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QProxyModel class provides support for processing data passed between another model and a view. <a href="#details">More...</a></p> <p>Inherits <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qproxymodel.html#QProxyModel">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" />int <b><a href="qproxymodel.html#columnCount">columnCount</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />QVariant <b><a href="qproxymodel.html#data">data</a></b> (<i>self</i>, QModelIndex <i>index</i>, int <i>role</i> = Qt.DisplayRole)</li><li><div class="fn" />bool <b><a href="qproxymodel.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, QMimeData <i>data</i>, Qt.DropAction <i>action</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>parent</i>)</li><li><div class="fn" /><b><a href="qproxymodel.html#fetchMore">fetchMore</a></b> (<i>self</i>, QModelIndex <i>parent</i>)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qproxymodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qproxymodel.html#hasChildren">hasChildren</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />QVariant <b><a href="qproxymodel.html#headerData">headerData</a></b> (<i>self</i>, int <i>section</i>, Qt.Orientation <i>orientation</i>, int <i>role</i> = Qt.DisplayRole)</li><li><div class="fn" />QModelIndex <b><a href="qproxymodel.html#index">index</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qproxymodel.html#insertColumns">insertColumns</a></b> (<i>self</i>, int <i>column</i>, int <i>count</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qproxymodel.html#insertRows">insertRows</a></b> (<i>self</i>, int <i>row</i>, int <i>count</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />list-of-QModelIndex <b><a href="qproxymodel.html#match">match</a></b> (<i>self</i>, QModelIndex <i>start</i>, int <i>role</i>, QVariant <i>value</i>, int <i>hits</i> = 1, Qt.MatchFlags <i>flags</i> = Qt.MatchFlags(Qt.MatchStartsWith|Qt.MatchWrap))</li><li><div class="fn" />QMimeData <b><a href="qproxymodel.html#mimeData">mimeData</a></b> (<i>self</i>, list-of-QModelIndex <i>indexes</i>)</li><li><div class="fn" />QStringList <b><a href="qproxymodel.html#mimeTypes">mimeTypes</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractItemModel <b><a href="qproxymodel.html#model">model</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qproxymodel.html#parent">parent</a></b> (<i>self</i>, QModelIndex <i>child</i>)</li><li><div class="fn" />QObject <b><a href="qproxymodel.html#parent-2">parent</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qproxymodel.html#revert">revert</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qproxymodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qproxymodel.html#setData">setData</a></b> (<i>self</i>, QModelIndex <i>index</i>, QVariant <i>value</i>, int <i>role</i> = Qt.EditRole)</li><li><div class="fn" />bool <b><a href="qproxymodel.html#setHeaderData">setHeaderData</a></b> (<i>self</i>, int <i>section</i>, Qt.Orientation <i>orientation</i>, QVariant <i>value</i>, int <i>role</i> = Qt.EditRole)</li><li><div class="fn" /><b><a href="qproxymodel.html#setModel">setModel</a></b> (<i>self</i>, QAbstractItemModel <i>model</i>)</li><li><div class="fn" /><b><a href="qproxymodel.html#sort">sort</a></b> (<i>self</i>, int <i>column</i>, Qt.SortOrder <i>order</i> = Qt.AscendingOrder)</li><li><div class="fn" />QSize <b><a href="qproxymodel.html#span">span</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qproxymodel.html#submit">submit</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.DropActions <b><a href="qproxymodel.html#supportedDropActions">supportedDropActions</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QProxyModel class provides support for processing data passed between another model and a view.</p> <p>If you want to do filtering and sorting, see <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a>.</p> <p>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.</p> <p>Just as with subclasses of <a href="qabstractitemview.html">QAbstractItemView</a>, QProxyModel provides the <a href="qproxymodel.html#setModel">setModel</a>() 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 <a href="qabstractitemview.html#setModel">QAbstractItemView.setModel</a>().</p> <p>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.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QProxyModel" />QProxyModel.__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> <h3 class="fn"><a name="columnCount" />int QProxyModel.columnCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#columnCount">QAbstractItemModel.columnCount</a>().</p> <p>Returns the number of columns for the given <i>parent</i>.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#columnCount">QAbstractItemModel.columnCount</a>().</p> <h3 class="fn"><a name="data" />QVariant QProxyModel.data (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, int <i>role</i> = Qt.DisplayRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#data">QAbstractItemModel.data</a>().</p> <p>Returns the data stored in the item with the given <i>index</i> under the specified <i>role</i>.</p> <p><b>See also</b> <a href="qproxymodel.html#setData">setData</a>().</p> <h3 class="fn"><a name="dropMimeData" />bool QProxyModel.dropMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a> <i>data</i>, <a href="qt.html#DropAction-enum">Qt.DropAction</a> <i>action</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#dropMimeData">QAbstractItemModel.dropMimeData</a>().</p> <p>Returns true if the model accepts the <i>data</i> dropped onto an attached view for the specified <i>action</i>; otherwise returns false.</p> <p>The <i>parent</i>, <i>row</i>, and <i>column</i> 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.</p> <h3 class="fn"><a name="fetchMore" />QProxyModel.fetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#fetchMore">QAbstractItemModel.fetchMore</a>().</p> <p>Fetches more child items of the given <i>parent</i>. This function is used by views to tell the model that they can display more data than the model has provided.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#fetchMore">QAbstractItemModel.fetchMore</a>().</p> <h3 class="fn"><a name="flags" /><a href="qt-itemflags.html">Qt.ItemFlags</a> QProxyModel.flags (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#flags">QAbstractItemModel.flags</a>().</p> <p>Returns the item flags for the given <i>index</i>.</p> <h3 class="fn"><a name="hasChildren" />bool QProxyModel.hasChildren (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#hasChildren">QAbstractItemModel.hasChildren</a>().</p> <p>Returns true if the item corresponding to the <i>parent</i> index has child items; otherwise returns false.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#hasChildren">QAbstractItemModel.hasChildren</a>().</p> <h3 class="fn"><a name="headerData" />QVariant QProxyModel.headerData (<i>self</i>, int <i>section</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a> <i>orientation</i>, int <i>role</i> = Qt.DisplayRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#headerData">QAbstractItemModel.headerData</a>().</p> <p>Returns the data stored in the <i>section</i> of the header with specified <i>orientation</i> under the given <i>role</i>.</p> <p><b>See also</b> <a href="qproxymodel.html#setHeaderData">setHeaderData</a>().</p> <h3 class="fn"><a name="index" /><a href="qmodelindex.html">QModelIndex</a> QProxyModel.index (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#index">QAbstractItemModel.index</a>().</p> <p>Returns the model index with the given <i>row</i>, <i>column</i>, and <i>parent</i>.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#index">QAbstractItemModel.index</a>().</p> <h3 class="fn"><a name="insertColumns" />bool QProxyModel.insertColumns (<i>self</i>, int <i>column</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#insertColumns">QAbstractItemModel.insertColumns</a>().</p> <p>Inserts <i>count</i> columns into the model, creating new items as children of the given <i>parent</i>. The new columns are inserted before the <i>column</i> specified. If the <i>parent</i> item has no children, a single row is created to contain the required number of columns.</p> <p>Returns true if the columns were successfully inserted; otherwise returns false.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#insertColumns">QAbstractItemModel.insertColumns</a>().</p> <h3 class="fn"><a name="insertRows" />bool QProxyModel.insertRows (<i>self</i>, int <i>row</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel.insertRows</a>().</p> <p>Inserts <i>count</i> rows into the model, creating new items as children of the given <i>parent</i>. The new rows are inserted before the <i>row</i> specified. If the <i>parent</i> item has no children, a single column is created to contain the required number of rows.</p> <p>Returns true if the rows were successfully inserted; otherwise returns false.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#insertRows">QAbstractItemModel.insertRows</a>().</p> <h3 class="fn"><a name="match" />list-of-QModelIndex QProxyModel.match (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>start</i>, int <i>role</i>, QVariant <i>value</i>, int <i>hits</i> = 1, <a href="qt-matchflags.html">Qt.MatchFlags</a> <i>flags</i> = Qt.MatchFlags(Qt.MatchStartsWith|Qt.MatchWrap))</h3><p>Reimplemented from <a href="qabstractitemmodel.html#match">QAbstractItemModel.match</a>().</p> <p>Returns a list of model indexes that each contain the given <i>value</i> for the <i>role</i> specified. The search begins at the <i>start</i> index and is performed according to the specified <i>flags</i>. The search continues until the number of matching data items equals <i>hits</i>, the last row is reached, or the search reaches <i>start</i> again, depending on whether <tt>MatchWrap</tt> is specified in <i>flags</i>.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#match">QAbstractItemModel.match</a>().</p> <h3 class="fn"><a name="mimeData" /><a href="qmimedata.html">QMimeData</a> QProxyModel.mimeData (<i>self</i>, list-of-QModelIndex <i>indexes</i>)</h3><p>The <i>QMimeData</i> result</p><p>Reimplemented from <a href="qabstractitemmodel.html#mimeData">QAbstractItemModel.mimeData</a>().</p> <p>Returns MIME data for the specified <i>indexes</i> in the model.</p> <h3 class="fn"><a name="mimeTypes" />QStringList QProxyModel.mimeTypes (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#mimeTypes">QAbstractItemModel.mimeTypes</a>().</p> <p>Returns a list of MIME types that are supported by the model.</p> <h3 class="fn"><a name="model" /><a href="qabstractitemmodel.html">QAbstractItemModel</a> QProxyModel.model (<i>self</i>)</h3><p>Returns the model that contains the data that is available through the proxy model.</p> <p><b>See also</b> <a href="qproxymodel.html#setModel">setModel</a>().</p> <h3 class="fn"><a name="parent" /><a href="qmodelindex.html">QModelIndex</a> QProxyModel.parent (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>child</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#parent">QAbstractItemModel.parent</a>().</p> <p>Returns the model index that corresponds to the parent of the given <i>child</i> index.</p> <h3 class="fn"><a name="parent-2" /><a href="qobject.html">QObject</a> QProxyModel.parent (<i>self</i>)</h3><h3 class="fn"><a name="revert" />QProxyModel.revert (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#revert">QAbstractItemModel.revert</a>().</p> <h3 class="fn"><a name="rowCount" />int QProxyModel.rowCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Reimplemented from <a href="qabstractitemmodel.html#rowCount">QAbstractItemModel.rowCount</a>().</p> <p>Returns the number of rows for the given <i>parent</i>.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#rowCount">QAbstractItemModel.rowCount</a>().</p> <h3 class="fn"><a name="setData" />bool QProxyModel.setData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, QVariant <i>value</i>, int <i>role</i> = Qt.EditRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#setData">QAbstractItemModel.setData</a>().</p> <p>Sets the <i>role</i> data for the item at <i>index</i> to <i>value</i>. Returns true if successful; otherwise returns false.</p> <p>The base class implementation returns false. This function and <a href="qproxymodel.html#data">data</a>() must be reimplemented for editable models.</p> <p><b>See also</b> <a href="qproxymodel.html#data">data</a>(), <a href="qabstractitemmodel.html#itemData">itemData</a>(), and <a href="qabstractitemmodel.html#setData">QAbstractItemModel.setData</a>().</p> <h3 class="fn"><a name="setHeaderData" />bool QProxyModel.setHeaderData (<i>self</i>, int <i>section</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a> <i>orientation</i>, QVariant <i>value</i>, int <i>role</i> = Qt.EditRole)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#setHeaderData">QAbstractItemModel.setHeaderData</a>().</p> <p>Sets the <i>role</i> data in the <i>section</i> of the header with the specified <i>orientation</i> to the <i>value</i> given.</p> <p><b>See also</b> <a href="qproxymodel.html#headerData">headerData</a>() and <a href="qabstractitemmodel.html#setHeaderData">QAbstractItemModel.setHeaderData</a>().</p> <h3 class="fn"><a name="setModel" />QProxyModel.setModel (<i>self</i>, <a href="qabstractitemmodel.html">QAbstractItemModel</a> <i>model</i>)</h3><p>Sets the given <i>model</i> to be processed by the proxy model.</p> <p><b>See also</b> <a href="qproxymodel.html#model">model</a>().</p> <h3 class="fn"><a name="sort" />QProxyModel.sort (<i>self</i>, int <i>column</i>, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a> <i>order</i> = Qt.AscendingOrder)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#sort">QAbstractItemModel.sort</a>().</p> <p>Sorts the child items in the specified <i>column</i> according to the sort order defined by <i>order</i>.</p> <p><b>See also</b> <a href="qabstractitemmodel.html#sort">QAbstractItemModel.sort</a>().</p> <h3 class="fn"><a name="span" /><a href="qsize.html">QSize</a> QProxyModel.span (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#span">QAbstractItemModel.span</a>().</p> <p>Returns the size of the item that corresponds to the specified <i>index</i>.</p> <h3 class="fn"><a name="submit" />bool QProxyModel.submit (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#submit">QAbstractItemModel.submit</a>().</p> <h3 class="fn"><a name="supportedDropActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QProxyModel.supportedDropActions (<i>self</i>)</h3><p>Reimplemented from <a href="qabstractitemmodel.html#supportedDropActions">QAbstractItemModel.supportedDropActions</a>().</p> <p>Returns the drop actions that are supported by the model; this is a combination of the individual actions defined in <a href="qt.html#DropAction-enum">Qt.DropActions</a>.</p> <p>The selection of drop actions provided by the model will influence the behavior of the component that started the drag and drop operation.</p> <p><b>See also</b> <a href="dnd.html">Drag and Drop</a>.</p> <address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 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> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>