1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
<?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>QAbstractItemModel 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">QAbstractItemModel Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QAbstractItemModel class provides the abstract interface for item model classes. <a href="#details">More...</a></p>
<p>Inherits <a href="qobject.html">QObject</a>.</p><p>Inherited by <a href="qabstractlistmodel.html">QAbstractListModel</a>, <a href="qabstractproxymodel.html">QAbstractProxyModel</a>, <a href="qabstracttablemodel.html">QAbstractTableModel</a>, <a href="qdirmodel.html">QDirModel</a>, <a href="qproxymodel.html">QProxyModel</a> and <a href="qstandarditemmodel.html">QStandardItemModel</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qabstractitemmodel.html#QAbstractItemModel">__init__</a></b> (<i>self</i>, QObject <i>parent</i> = None)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a></b> (<i>self</i>, QModelIndex <i>parent</i>, int <i>first</i>, int <i>last</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#buddy">buddy</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a></b> (<i>self</i>, QModelIndex <i>parent</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a></b> (<i>self</i>, QModelIndex <i>from</i>, QModelIndex <i>to</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#changePersistentIndexList">changePersistentIndexList</a></b> (<i>self</i>, QModelIndex-list <i>from</i>, QModelIndex-list <i>to</i>)</li><li><div class="fn" />int <b><a href="qabstractitemmodel.html#columnCount">columnCount</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#createIndex">createIndex</a></b> (<i>self</i>, int <i>arow</i>, int <i>acolumn</i>, int <i>aid</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#createIndex-2">createIndex</a></b> (<i>self</i>, int <i>arow</i>, int <i>acolumn</i>, object <i>adata</i> = 0)</li><li><div class="fn" />QVariant <b><a href="qabstractitemmodel.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="qabstractitemmodel.html#decodeData">decodeData</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>parent</i>, QDataStream <i>stream</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.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="qabstractitemmodel.html#encodeData">encodeData</a></b> (<i>self</i>, QModelIndex-list <i>indexes</i>, QDataStream <i>stream</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#fetchMore">fetchMore</a></b> (<i>self</i>, QModelIndex <i>parent</i>)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qabstractitemmodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#hasChildren">hasChildren</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#hasIndex">hasIndex</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />QVariant <b><a href="qabstractitemmodel.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="qabstractitemmodel.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="qabstractitemmodel.html#insertColumn">insertColumn</a></b> (<i>self</i>, int <i>acolumn</i>, QModelIndex <i>aparent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.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="qabstractitemmodel.html#insertRow">insertRow</a></b> (<i>self</i>, int <i>arow</i>, QModelIndex <i>aparent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.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" />int-QVariant-dict <b><a href="qabstractitemmodel.html#itemData">itemData</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />QModelIndex-list <b><a href="qabstractitemmodel.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="qabstractitemmodel.html#mimeData">mimeData</a></b> (<i>self</i>, QModelIndex-list <i>indexes</i>)</li><li><div class="fn" />QStringList <b><a href="qabstractitemmodel.html#mimeTypes">mimeTypes</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#parent">parent</a></b> (<i>self</i>, QModelIndex <i>child</i>)</li><li><div class="fn" />QObject <b><a href="qabstractitemmodel.html#parent-2">parent</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeColumn">removeColumn</a></b> (<i>self</i>, int <i>acolumn</i>, QModelIndex <i>aparent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeColumns">removeColumns</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="qabstractitemmodel.html#removeRow">removeRow</a></b> (<i>self</i>, int <i>arow</i>, QModelIndex <i>aparent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeRows">removeRows</a></b> (<i>self</i>, int <i>row</i>, int <i>count</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#reset">reset</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#revert">revert</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractitemmodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex <i>parent</i> = QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.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="qabstractitemmodel.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" />bool <b><a href="qabstractitemmodel.html#setItemData">setItemData</a></b> (<i>self</i>, QModelIndex <i>index</i>, int-QVariant-dict <i>roles</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#sibling">sibling</a></b> (<i>self</i>, int <i>row</i>, int <i>column</i>, QModelIndex <i>idx</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.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="qabstractitemmodel.html#span">span</a></b> (<i>self</i>, QModelIndex <i>index</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#submit">submit</a></b> (<i>self</i>)</li><li><div class="fn" />Qt.DropActions <b><a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a></b> (<i>self</i>)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qabstractitemmodel.html#dataChanged">dataChanged</a></b> (const QModelIndex&,const QModelIndex&)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a></b> (Qt::Orientation,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractItemModel class provides the abstract interface for item model classes.</p>
<p>The QAbstractItemModel class defines the standard interface that item models must use to be able to interoperate with other components in the model/view architecture. It is not supposed to be instantiated directly. Instead, you should subclass it to create new models.</p>
<p>The QAbstractItemModel class is one of the <a href="model-view.html">Model/View Classes</a> and is part of Qt's <a href="model-view-programming.html">model/view framework</a>.</p>
<p>If you need a model to use with a <a href="qlistview.html">QListView</a> or a <a href="qtableview.html">QTableView</a>, you should consider subclassing <a href="qabstractlistmodel.html">QAbstractListModel</a> or <a href="qabstracttablemodel.html">QAbstractTableModel</a> instead of this class.</p>
<p>The underlying data model is exposed to views and delegates as a hierarchy of tables. If you don't make use of the hierarchy, then the model is a simple table of rows and columns. Each item has a unique index specified by a <a href="qmodelindex.html">QModelIndex</a>.</p>
<p align="center"><img src="images/modelindex-no-parent.png" /></p>
<p>Every item of data that can be accessed via a model has an associated model index that is obtained using the <a href="qabstractitemmodel.html#index">index</a>() function. Each index may have a <a href="qabstractitemmodel.html#sibling">sibling</a>() index; child items have a <a href="qabstractitemmodel.html#parent">parent</a>() index.</p>
<p>Each item has a number of data elements associated with it, and each of these can be retrieved by specifying a role (see <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>) to the model's <a href="qabstractitemmodel.html#data">data</a>() function. Data for all available roles can be obtained at the same time using the <a href="qabstractitemmodel.html#itemData">itemData</a>() function.</p>
<p>Data for each role is set using a particular <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>. Data for individual roles are set individually with <a href="qabstractitemmodel.html#setData">setData</a>(), or they can be set for all roles with <a href="qabstractitemmodel.html#setItemData">setItemData</a>().</p>
<p>Items can be queried with <a href="qabstractitemmodel.html#flags">flags</a>() (see <a href="qt.html#ItemFlag-enum">Qt.ItemFlag</a>) to see if they can be selected, dragged, or manipulated in other ways.</p>
<p>If an item has child objects, <a href="qabstractitemmodel.html#hasChildren">hasChildren</a>() returns true for the corresponding index.</p>
<p>The model has a <a href="qabstractitemmodel.html#rowCount">rowCount</a>() and a <a href="qabstractitemmodel.html#columnCount">columnCount</a>() for each level of the hierarchy. Rows and columns can be inserted and removed with <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), and <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>().</p>
<p>The model emits signals to indicate changes. For example, <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() is emitted whenever items of data made available by the model are changed. Changes to the headers supplied by the model cause <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>() to be emitted. If the structure of the underlying data changes, the model can emit <a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>() to indicate to any attached views that they should redisplay any items shown, taking the new structure into account.</p>
<p>The items available through the model can be searched for particular data using the <a href="qabstractitemmodel.html#match">match</a>() function.</p>
<p>If the model is sortable, it can be sorted with <a href="qabstractitemmodel.html#sort">sort</a>().</p>
<a id="subclassing" name="subclassing" />
<h3>Subclassing</h3>
<p>When subclassing QAbstractItemModel, at the very least you must implement <a href="qabstractitemmodel.html#index">index</a>(), <a href="qabstractitemmodel.html#parent">parent</a>(), <a href="qabstractitemmodel.html#rowCount">rowCount</a>(), <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), and <a href="qabstractitemmodel.html#data">data</a>(). To enable editing in your model, you must also implement <a href="qabstractitemmodel.html#setData">setData</a>(), and reimplement <a href="qabstractitemmodel.html#flags">flags</a>() to ensure that <tt>ItemIsEditable</tt> is returned. You can also reimplement <a href="qabstractitemmodel.html#headerData">headerData</a>() and <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>() to control the way the headers for your model are presented.</p>
<p>Note that the <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() and <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>() signals must be emitted explicitly when reimplementing the <a href="qabstractitemmodel.html#setData">setData</a>() and <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>() functions, respectively.</p>
<p>Custom models need to create model indexes for other components to use. To do this, call <a href="qabstractitemmodel.html#createIndex">createIndex</a>() with suitable row and column numbers for the item, and supply a unique identifier for the item, either as a pointer or as an integer value. Custom models typically use these unique identifiers in other reimplemented functions to retrieve item data and access information about the item's parents and children. See the <a href="itemviews-simpletreemodel.html">Simple Tree Model</a> example for more information about unique identifiers.</p>
<p>It is not necessary to support every role defined in <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>. Depending on the type of data contained within a model, it may only be useful to implement the <a href="qabstractitemmodel.html#data">data</a>() function to return valid information for some of the more common roles. Most models provide at least a textual representation of item data for the <a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a>, and well-behaved models should also provide valid information for the <a href="qt.html#ItemDataRole-enum">Qt.ToolTipRole</a> and <a href="qt.html#ItemDataRole-enum">Qt.WhatsThisRole</a>. Supporting these roles enables models to be used with standard Qt views. However, for some models that handle highly-specialized data, it may be appropriate to provide data only for user-defined roles.</p>
<p>Models that provide interfaces to resizable data structures can provide implementations of <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(), and <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(). When implementing these functions, it is important to notify any connected views about changes to the model's dimensions both <i>before</i> and <i>after</i> they occur:</p>
<ul>
<li>An <a href="qabstractitemmodel.html#insertRows">insertRows</a>() implementation must call <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>() <i>before</i> inserting new rows into the data structure, and it must call <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>() <i>immediately afterwards</i>.</li>
<li>An <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() implementation must call <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>() <i>before</i> inserting new columns into the data structure, and it must call <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>() <i>immediately afterwards</i>.</li>
<li>A <a href="qabstractitemmodel.html#removeRows">removeRows</a>() implementation must call <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>() <i>before</i> the rows are removed from the data structure, and it must call <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>() <i>immediately afterwards</i>.</li>
<li>A <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() implementation must call <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>() <i>before</i> the columns are removed from the data structure, and it must call <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>() <i>immediately afterwards</i>.</li>
</ul>
<p>The <i>private</i> signals that these functions emit give attached components the chance to take action before any data becomes unavailable. The encapsulation of the insert and remove operations with these begin and end functions also enables the model to manage <a href="qpersistentmodelindex.html">persistent model indexes</a> correctly. <b>If you want selections to be handled properly, you must ensure that you call these functions.</b></p>
<p>See also <a href="model-view-programming.html">Model/View Programming</a>, <a href="qmodelindex.html">QModelIndex</a>, <a href="qabstractitemview.html">QAbstractItemView</a>, and <a href="model-view-dnd.html">Using Drag and Drop with Item Views</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractItemModel" />QAbstractItemModel.__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 an abstract item model with the given <i>parent</i>.</p>
<h3 class="fn"><a name="beginInsertColumns" />QAbstractItemModel.beginInsertColumns (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>Begins a column insertion operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() in a subclass, you must call this function <i>before</i> inserting data into the model's underlying data store.</p>
<p>The <i>parent</i> index corresponds to the parent into which the new columns are inserted; <i>first</i> and <i>last</i> are the column numbers of the new columns to be inserted.</p>
<p>See also <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>().</p>
<h3 class="fn"><a name="beginInsertRows" />QAbstractItemModel.beginInsertRows (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>Begins a row insertion operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#insertRows">insertRows</a>() in a subclass, you must call this function <i>before</i> inserting data into the model's underlying data store.</p>
<p>The <i>parent</i> index corresponds to the parent into which the new rows are inserted; <i>first</i> and <i>last</i> are the row numbers of the new rows to be inserted.</p>
<p>See also <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>().</p>
<h3 class="fn"><a name="beginRemoveColumns" />QAbstractItemModel.beginRemoveColumns (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>Begins a column removal operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() in a subclass, you must call this function <i>before</i> removing data from the model's underlying data store.</p>
<p>The <i>parent</i> index corresponds to the parent from which the new columns are removed; <i>first</i> and <i>last</i> are the column numbers of the columns to be removed.</p>
<p>See also <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>().</p>
<h3 class="fn"><a name="beginRemoveRows" />QAbstractItemModel.beginRemoveRows (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, int <i>first</i>, int <i>last</i>)</h3><p>Begins a row removal operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#removeRows">removeRows</a>() in a subclass, you must call this function <i>before</i> removing data from the model's underlying data store.</p>
<p>The <i>parent</i> index corresponds to the parent from which the new rows are removed; <i>first</i> and <i>last</i> are the row numbers of the rows to be removed.</p>
<p>See also <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>().</p>
<h3 class="fn"><a name="buddy" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.buddy (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns a model index for the buddy of the item represented by <i>index</i>. When the user wants to edit an item, the view will call this function to check whether another item in the model should be edited instead, and construct a delegate using the model index returned by the buddy item.</p>
<p>In the default implementation each item is its own buddy.</p>
<h3 class="fn"><a name="canFetchMore" />bool QAbstractItemModel.canFetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>)</h3><p>Returns true if there is more data available for <i>parent</i>, otherwise false.</p>
<p>The default implementation always returns false.</p>
<p>See also <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>().</p>
<h3 class="fn"><a name="changePersistentIndex" />QAbstractItemModel.changePersistentIndex (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>from</i>, <a href="qmodelindex.html">QModelIndex</a> <i>to</i>)</h3><p>Changes the <a href="qpersistentmodelindex.html">QPersistentModelIndex</a> that is equal to the given <i>from</i> model index to the given <i>to</i> model index.</p>
<p>If no persistent model index equal to the given <i>from</i> model index was found, nothing is changed.</p>
<h3 class="fn"><a name="changePersistentIndexList" />QAbstractItemModel.changePersistentIndexList (<i>self</i>, QModelIndex-list <i>from</i>, QModelIndex-list <i>to</i>)</h3><p>Changes the QPersistentModelIndexes that is equal to the indexes in the given <i>from</i> model index list to the given <i>to</i> model index list.</p>
<p>If no persistent model indexes equal to the indexes in the given <i>from</i> model index list was found, nothing is changed.</p>
<p>This function was introduced in Qt 4.1.</p>
<h3 class="fn"><a name="columnCount" />int QAbstractItemModel.columnCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the number of columns for the given <i>parent</i>.</p>
<h3 class="fn"><a name="createIndex" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.createIndex (<i>self</i>, int <i>arow</i>, int <i>acolumn</i>, int <i>aid</i>)</h3><p>Creates a model index for the given <i>row</i> and <i>column</i> with the internal pointer <i>ptr</i>.</p>
<p>This function provides a consistent interface that model subclasses must use to create model indexes.</p>
<h3 class="fn"><a name="createIndex-2" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.createIndex (<i>self</i>, int <i>arow</i>, int <i>acolumn</i>, object <i>adata</i> = 0)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Creates a model index for the given <i>row</i> and <i>column</i> with the internal identifier <i>id</i>.</p>
<p>This function provides a consistent interface that model subclasses must use to create model indexes.</p>
<h3 class="fn"><a name="data" /><a href="qvariant.html">QVariant</a> QAbstractItemModel.data (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, int <i>role</i> = Qt.DisplayRole)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the data stored under the given <i>role</i> for the item referred to by the <i>index</i>.</p>
<p>See also <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, <a href="qabstractitemmodel.html#setData">setData</a>(), and <a href="qabstractitemmodel.html#headerData">headerData</a>().</p>
<h3 class="fn"><a name="decodeData" />bool QAbstractItemModel.decodeData (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>, <a href="qdatastream.html">QDataStream</a> <i>stream</i>)</h3><h3 class="fn"><a name="dropMimeData" />bool QAbstractItemModel.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>Handles the <i>data</i> supplied by a drag and drop operation that ended with the given <i>action</i>. Although the specified <i>row</i>, <i>column</i> and <i>parent</i> indicate the location of an item in the model where the operation ended, it is the responsibility of the view to provide a suitable location for where the data should be inserted.</p>
<p>For instance, a drop action on an item in a <a href="qtreeview.html">QTreeView</a> can result in new items either being inserted as children of the item specified by <i>row</i>, <i>column</i>, and <i>parent</i>, or as siblings of the item.</p>
<p>See also <a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a>().</p>
<h3 class="fn"><a name="encodeData" />QAbstractItemModel.encodeData (<i>self</i>, QModelIndex-list <i>indexes</i>, <a href="qdatastream.html">QDataStream</a> <i>stream</i>)</h3><h3 class="fn"><a name="endInsertColumns" />QAbstractItemModel.endInsertColumns (<i>self</i>)</h3><p>Ends a column insertion operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() in a subclass, you must call this function <i>after</i> inserting data into the model's underlying data store.</p>
<p>See also <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
<h3 class="fn"><a name="endInsertRows" />QAbstractItemModel.endInsertRows (<i>self</i>)</h3><p>Ends a row insertion operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#insertRows">insertRows</a>() in a subclass, you must call this function <i>after</i> inserting data into the model's underlying data store.</p>
<p>See also <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
<h3 class="fn"><a name="endRemoveColumns" />QAbstractItemModel.endRemoveColumns (<i>self</i>)</h3><p>Ends a column removal operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() in a subclass, you must call this function <i>after</i> removing data from the model's underlying data store.</p>
<p>See also <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
<h3 class="fn"><a name="endRemoveRows" />QAbstractItemModel.endRemoveRows (<i>self</i>)</h3><p>Ends a row removal operation.</p>
<p>When reimplementing <a href="qabstractitemmodel.html#removeRows">removeRows</a>() in a subclass, you must call this function <i>after</i> removing data from the model's underlying data store.</p>
<p>See also <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
<h3 class="fn"><a name="fetchMore" />QAbstractItemModel.fetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i>)</h3><p>Fetches any available data for the items with the parent specified by the <i>parent</i> index.</p>
<p>Reimplement this if you have incremental data.</p>
<p>The default implementation does nothing.</p>
<p>See also <a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a>().</p>
<h3 class="fn"><a name="flags" /><a href="qt-itemflags.html">Qt.ItemFlags</a> QAbstractItemModel.flags (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns the item flags for the given <i>index</i>.</p>
<p>The base class implementation returns a combination of flags that enables the item (<tt>ItemIsEnabled</tt>) and allows it to be selected (<tt>ItemIsSelectable</tt>).</p>
<p>See also <a href="qt.html#ItemFlag-enum">Qt.ItemFlags</a>.</p>
<h3 class="fn"><a name="hasChildren" />bool QAbstractItemModel.hasChildren (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Returns true if <i>parent</i> has any children; otherwise returns false. Use <a href="qabstractitemmodel.html#rowCount">rowCount</a>() on the parent to find out the number of children.</p>
<p>See also <a href="qabstractitemmodel.html#parent">parent</a>() and <a href="qabstractitemmodel.html#index">index</a>().</p>
<h3 class="fn"><a name="hasIndex" />bool QAbstractItemModel.hasIndex (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>Returns true if the model returns a valid <a href="qmodelindex.html">QModelIndex</a> for <i>row</i> and <i>column</i> with <i>parent</i>, otherwise returns false.</p>
<h3 class="fn"><a name="headerData" /><a href="qvariant.html">QVariant</a> QAbstractItemModel.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>Returns the data for the given <i>role</i> and <i>section</i> in the header with the specified <i>orientation</i>.</p>
<p>See also <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>(), and <a href="qheaderview.html">QHeaderView</a>.</p>
<h3 class="fn"><a name="index" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.index (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the index of the item in the model specified by the given <i>row</i>, <i>column</i> and <i>parent</i> index.</p>
<h3 class="fn"><a name="insertColumn" />bool QAbstractItemModel.insertColumn (<i>self</i>, int <i>acolumn</i>, <a href="qmodelindex.html">QModelIndex</a> <i>aparent</i> = QModelIndex())</h3><p>Inserts a single column before the given <i>column</i> in the child items of the <i>parent</i> specified. Returns true if the column is inserted; otherwise returns false.</p>
<p>See also <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(), <a href="qabstractitemmodel.html#insertRow">insertRow</a>(), and <a href="qabstractitemmodel.html#removeColumn">removeColumn</a>().</p>
<h3 class="fn"><a name="insertColumns" />bool QAbstractItemModel.insertColumns (<i>self</i>, int <i>column</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>On models that support this, inserts <i>count</i> new columns into the model before the given <i>column</i>. The items in each new column will be children of the item represented by the <i>parent</i> model index.</p>
<p>If <i>column</i> is 0, the columns are prepended to any existing columns. If <i>column</i> is <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), the columns are appended to any existing columns. If <i>parent</i> has no children, a single row with <i>count</i> columns is inserted.</p>
<p>Returns true if the columns were successfully inserted; otherwise returns false.</p>
<p>The base class implementation does nothing and returns false.</p>
<p>If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide you own API for altering the data.</p>
<p>See also <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(), <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>(), and <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>().</p>
<h3 class="fn"><a name="insertRow" />bool QAbstractItemModel.insertRow (<i>self</i>, int <i>arow</i>, <a href="qmodelindex.html">QModelIndex</a> <i>aparent</i> = QModelIndex())</h3><p>Inserts a single row before the given <i>row</i> in the child items of the <i>parent</i> specified. Returns true if the row is inserted; otherwise returns false.</p>
<p>See also <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#insertColumn">insertColumn</a>(), and <a href="qabstractitemmodel.html#removeRow">removeRow</a>().</p>
<h3 class="fn"><a name="insertRows" />bool QAbstractItemModel.insertRows (<i>self</i>, int <i>row</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>On models that support this, inserts <i>count</i> rows into the model before the given <i>row</i>. The items in the new row will be children of the item represented by the <i>parent</i> model index.</p>
<p>If <i>row</i> is 0, the rows are prepended to any existing rows in the parent. If <i>row</i> is <a href="qabstractitemmodel.html#rowCount">rowCount</a>(), the rows are appended to any existing rows in the parent. If <i>parent</i> has no children, a single column with <i>count</i> rows is inserted.</p>
<p>Returns true if the rows were successfully inserted; otherwise returns false.</p>
<p>The base class implementation does nothing and returns false.</p>
<p>If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide you own API for altering the data.</p>
<p>See also <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>(), and <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>().</p>
<h3 class="fn"><a name="itemData" />int-QVariant-dict QAbstractItemModel.itemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns a map with values for all predefined roles in the model for the item at the given <i>index</i>.</p>
<p>Reimplemented this function if you want to extend the default behavior of this function to include custom roles in the map.</p>
<p>See also <a href="qabstractitemmodel.html#setItemData">setItemData</a>(), <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, and <a href="qabstractitemmodel.html#data">data</a>().</p>
<h3 class="fn"><a name="match" />QModelIndex-list QAbstractItemModel.match (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>start</i>, int <i>role</i>, <a href="qvariant.html">QVariant</a> <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>Returns a list of indexes for the items where the data stored under the given <i>role</i> matches the specified <i>value</i>. The way the search is performed is defined by the <i>flags</i> given. The list that is returned may be empty.</p>
<p>The search starts from the <i>start</i> index, and continues until the number of matching data items equals <i>hits</i>, the search reaches the last row, or the search reaches <i>start</i> again, depending on whether <tt>MatchWrap</tt> is specified in <i>flags</i>.</p>
<h3 class="fn"><a name="mimeData" /><a href="qmimedata.html">QMimeData</a> QAbstractItemModel.mimeData (<i>self</i>, QModelIndex-list <i>indexes</i>)</h3><p>The <i>QMimeData</i> result</p><p>Returns an object that contains serialized items of data corresponding to the list of <i>indexes</i> specified. The formats used to describe the encoded data is obtained from the <a href="qabstractitemmodel.html#mimeTypes">mimeTypes</a>() function.</p>
<p>If the list of indexes is empty, 0 is returned rather than a serialized empty list.</p>
<h3 class="fn"><a name="mimeTypes" /><a href="qstringlist.html">QStringList</a> QAbstractItemModel.mimeTypes (<i>self</i>)</h3><p>Returns a list of MIME types that can be used to describe a list of model indexes.</p>
<p>See also <a href="qabstractitemmodel.html#mimeData">mimeData</a>().</p>
<h3 class="fn"><a name="parent" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.parent (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>child</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the parent of the model item with the given <i>index</i>.</p>
<h3 class="fn"><a name="parent-2" /><a href="qobject.html">QObject</a> QAbstractItemModel.parent (<i>self</i>)</h3><h3 class="fn"><a name="removeColumn" />bool QAbstractItemModel.removeColumn (<i>self</i>, int <i>acolumn</i>, <a href="qmodelindex.html">QModelIndex</a> <i>aparent</i> = QModelIndex())</h3><p>Removes the given <i>column</i> from the child items of the <i>parent</i> specified. Returns true if the column is removed; otherwise returns false.</p>
<p>See also <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(), <a href="qabstractitemmodel.html#removeRow">removeRow</a>(), and <a href="qabstractitemmodel.html#insertColumn">insertColumn</a>().</p>
<h3 class="fn"><a name="removeColumns" />bool QAbstractItemModel.removeColumns (<i>self</i>, int <i>column</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>On models that support this, removes <i>count</i> columns starting with the given <i>column</i> under parent <i>parent</i> from the model. Returns true if the columns were successfully removed; otherwise returns false.</p>
<p>The base class implementation does nothing and returns false.</p>
<p>If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide you own API for altering the data.</p>
<p>See also <a href="qabstractitemmodel.html#removeColumn">removeColumn</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(), <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>(), and <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>().</p>
<h3 class="fn"><a name="removeRow" />bool QAbstractItemModel.removeRow (<i>self</i>, int <i>arow</i>, <a href="qmodelindex.html">QModelIndex</a> <i>aparent</i> = QModelIndex())</h3><p>Removes the given <i>row</i> from the child items of the <i>parent</i> specified. Returns true if the row is removed; otherwise returns false.</p>
<p>See also <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#removeColumn">removeColumn</a>(), and <a href="qabstractitemmodel.html#insertRow">insertRow</a>().</p>
<h3 class="fn"><a name="removeRows" />bool QAbstractItemModel.removeRows (<i>self</i>, int <i>row</i>, int <i>count</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>On models that support this, removes <i>count</i> rows starting with the given <i>row</i> under parent <i>parent</i> from the model. Returns true if the rows were successfully removed; otherwise returns false.</p>
<p>The base class implementation does nothing and returns false.</p>
<p>If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide you own API for altering the data.</p>
<p>See also <a href="qabstractitemmodel.html#removeRow">removeRow</a>(), <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(), <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>(), and <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>().</p>
<h3 class="fn"><a name="reset" />QAbstractItemModel.reset (<i>self</i>)</h3><p>Resets the model to its original state in any attached views.</p>
<p>When a model is reset it means that any previous data reported from the model is now invalid and has to be queried for again.</p>
<p>When a model radically changes its data it can sometimes be easier to just call this function rather than emit <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() to inform other components when the underlying data source, or its structure, has changed.</p>
<p>See also <a href="qabstractitemmodel.html#modelReset">modelReset</a>().</p>
<h3 class="fn"><a name="revert" />QAbstractItemModel.revert (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>void revert()</tt>.</p><p>Called to let the model know that it should discart whatever it has cached. Typically used for row editing.</p>
<h3 class="fn"><a name="rowCount" />int QAbstractItemModel.rowCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>parent</i> = QModelIndex())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the number of rows under the given <i>parent</i>.</p>
<h3 class="fn"><a name="setData" />bool QAbstractItemModel.setData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, <a href="qvariant.html">QVariant</a> <i>value</i>, int <i>role</i> = Qt.EditRole)</h3><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 <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() signal should be emitted if the data was successfully set.</p>
<p>The base class implementation returns false. This function and <a href="qabstractitemmodel.html#data">data</a>() must be reimplemented for editable models. Note that the <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() signal must be emitted explicitly when reimplementing this function.</p>
<p>See also <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, <a href="qabstractitemmodel.html#data">data</a>(), and <a href="qabstractitemmodel.html#itemData">itemData</a>().</p>
<h3 class="fn"><a name="setHeaderData" />bool QAbstractItemModel.setHeaderData (<i>self</i>, int <i>section</i>, <a href="qt.html#Orientation-enum">Qt.Orientation</a> <i>orientation</i>, <a href="qvariant.html">QVariant</a> <i>value</i>, int <i>role</i> = Qt.EditRole)</h3><p>Sets the <i>role</i> for the header <i>section</i> to <i>value</i>. The <i>orientation</i> gives the orientation of the header.</p>
<p>Note that the <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>() signal must be emitted explicitly when reimplementing this function.</p>
<p>See also <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a> and <a href="qabstractitemmodel.html#headerData">headerData</a>().</p>
<h3 class="fn"><a name="setItemData" />bool QAbstractItemModel.setItemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>, int-QVariant-dict <i>roles</i>)</h3><p>For every <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a> in <i>roles</i>, sets the role data for the item at <i>index</i> to the associated value in <i>roles</i>. Returns true if successful; otherwise returns false.</p>
<p>See also <a href="qabstractitemmodel.html#setData">setData</a>(), <a href="qabstractitemmodel.html#data">data</a>(), and <a href="qabstractitemmodel.html#itemData">itemData</a>().</p>
<h3 class="fn"><a name="sibling" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.sibling (<i>self</i>, int <i>row</i>, int <i>column</i>, <a href="qmodelindex.html">QModelIndex</a> <i>idx</i>)</h3><p>Returns the sibling at <i>row</i> and <i>column</i> for the item at <i>index</i>, or an invalid <a href="qmodelindex.html">QModelIndex</a> if there is no sibling at that location.</p>
<p>sibling() is just a convenience function that finds the item's parent, and uses it to retrieve the index of the child item in the specified <i>row</i> and <i>column</i>.</p>
<p>See also <a href="qabstractitemmodel.html#index">index</a>(), <a href="qmodelindex.html#row">QModelIndex.row</a>(), and <a href="qmodelindex.html#column">QModelIndex.column</a>().</p>
<h3 class="fn"><a name="sort" />QAbstractItemModel.sort (<i>self</i>, int <i>column</i>, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a> <i>order</i> = Qt.AscendingOrder)</h3><p>Sorts the model by <i>column</i> in the given <i>order</i>.</p>
<p>The base class implementation does nothing.</p>
<h3 class="fn"><a name="span" /><a href="qsize.html">QSize</a> QAbstractItemModel.span (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a> <i>index</i>)</h3><p>Returns the row and column span of the item represented by <i>index</i>.</p>
<p>Note: span is not used currently, but will be in the future.</p>
<h3 class="fn"><a name="submit" />bool QAbstractItemModel.submit (<i>self</i>)</h3><p>This method is also a Qt slot with the C++ signature <tt>bool submit()</tt>.</p><p>Called to let the model know that it should submit whatever it has cached to the permanent storage. Typically used for row editing.</p>
<p>Returns false on error, otherwise true.</p>
<h3 class="fn"><a name="supportedDropActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QAbstractItemModel.supportedDropActions (<i>self</i>)</h3><p>Returns the drop actions supported by this model.</p>
<p>The default implementation returns <a href="qt.html#DropAction-enum">Qt.CopyAction</a>. It is only necessary to reimplement this function in subclasses if you wish to support more types of drag and drop operation.</p>
<p>See also <a href="qt.html#DropAction-enum">Qt.DropActions</a>.</p>
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="dataChanged" />void dataChanged (const QModelIndex&,const QModelIndex&)</h3><p>This signal is emitted whenever the data in an existing item changes. The affected items are those between <i>topLeft</i> and <i>bottomRight</i> inclusive (of the same parent).</p>
<p>Note that this signal must be emitted explicitly when reimplementing the <a href="qabstractitemmodel.html#setData">setData</a>() function.</p>
<p>See also <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>(), <a href="qabstractitemmodel.html#setData">setData</a>(), and <a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>().</p>
<h3 class="fn"><a name="headerDataChanged" />void headerDataChanged (Qt::Orientation,int,int)</h3><p>This signal is emitted whenever a header is changed. The <i>orientation</i> indicates whether the horizontal or vertical header has changed. The sections in the header from the <i>first</i> to the <i>last</i> need to be updated.</p>
<p>Note that this signal must be emitted explicitly when reimplementing the <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>() function.</p>
<p>If you are changing the number of columns or rows you don't need to emit this signal, but use the begin/end functions.</p>
<p>See also <a href="qabstractitemmodel.html#headerData">headerData</a>(), <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>(), and <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>().</p>
<h3 class="fn"><a name="layoutChanged" />void layoutChanged ()</h3><p>This signal is emitted whenever the layout of items exposed by the model changes; for example, when the model is sorted. When this signal is received by a view, it should update the layout of items to reflect this change.</p>
<p>When subclassing <a href="qabstractitemmodel.html">QAbstractItemModel</a> or <a href="qabstractproxymodel.html">QAbstractProxyModel</a>, ensure that you emit this signal if you change the order of items or alter the structure of the data you expose to views.</p>
<p>See also <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>(), <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>(), and <a href="qabstractitemmodel.html#reset">reset</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt 4.0.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.trolltech.com">Trolltech AS</a> 2006</td><td align="right" width="25%">Qt 4.1.4</td></tr></table></div></address></body></html>
|