~ubuntu-branches/ubuntu/precise/python-qt4/precise-proposed

« back to all changes in this revision

Viewing changes to doc/html/qabstractitemmodel.html

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell, Jonathan Riddell
  • Date: 2010-11-08 16:13:33 UTC
  • mfrom: (1.5.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20101108161333-0nec4wu0nz3wpf9r
Tags: 4.8.1-0ubuntu1
[ Jonathan Riddell ]
* New upstream release
* Build against python-sip-dev 4.11.2
* Remove kubuntu_02_fix-scpk-and-flag-issue.diff merged upstream
* Install __init__.py into /usr/lib/python3.2/dist-packages/PyQt4,
  fixes Python 3 support
* Add QtDeclarative to python-qt4
* Add kubuntu_03_uiparser.diff from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
td.postheader { font-family: sans-serif }
7
7
tr.address { font-family: sans-serif }
8
8
body { background: #ffffff; color: black; }
9
 
</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">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <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>
10
 
<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="qfilesystemmodel.html">QFileSystemModel</a>, <a href="qhelpcontentmodel.html">QHelpContentModel</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&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a></b> (<i>self</i>, QModelIndex, int, int)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a></b> (<i>self</i>, QModelIndex, int, int)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#beginMoveColumns">beginMoveColumns</a></b> (<i>self</i>, QModelIndex, int, int, QModelIndex, int)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a></b> (<i>self</i>, QModelIndex, int, int, QModelIndex, int)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a></b> (<i>self</i>, QModelIndex, int, int)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a></b> (<i>self</i>, QModelIndex, int, int)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#buddy">buddy</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a></b> (<i>self</i>, QModelIndex, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#changePersistentIndexList">changePersistentIndexList</a></b> (<i>self</i>, list-of-QModelIndex, list-of-QModelIndex)</li><li><div class="fn" />int <b><a href="qabstractitemmodel.html#columnCount">columnCount</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#createIndex">createIndex</a></b> (<i>self</i>, int, int, object&#160;<i>object</i>&#160;=&#160;0)</li><li><div class="fn" />QVariant <b><a href="qabstractitemmodel.html#data">data</a></b> (<i>self</i>, QModelIndex, int&#160;<i>role</i>&#160;=&#160;Qt.DisplayRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#decodeData">decodeData</a></b> (<i>self</i>, int, int, QModelIndex, QDataStream)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, QMimeData, Qt.DropAction, int, int, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#encodeData">encodeData</a></b> (<i>self</i>, list-of-QModelIndex, QDataStream)</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#endMoveColumns">endMoveColumns</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endMoveRows">endMoveRows</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#endResetModel">endResetModel</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#fetchMore">fetchMore</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qabstractitemmodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#hasChildren">hasChildren</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#hasIndex">hasIndex</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />QVariant <b><a href="qabstractitemmodel.html#headerData">headerData</a></b> (<i>self</i>, int, Qt.Orientation, int&#160;<i>role</i>&#160;=&#160;Qt.DisplayRole)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#index">index</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertColumn">insertColumn</a></b> (<i>self</i>, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertColumns">insertColumns</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertRow">insertRow</a></b> (<i>self</i>, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertRows">insertRows</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />dict-of-int-QVariant <b><a href="qabstractitemmodel.html#itemData">itemData</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />list-of-QModelIndex <b><a href="qabstractitemmodel.html#match">match</a></b> (<i>self</i>, QModelIndex, int, QVariant, int&#160;<i>hits</i>&#160;=&#160;1, Qt.MatchFlags&#160;<i>flags</i>&#160;=&#160;Qt.MatchStartsWith|Qt.MatchWrap)</li><li><div class="fn" />QMimeData <b><a href="qabstractitemmodel.html#mimeData">mimeData</a></b> (<i>self</i>, list-of-QModelIndex)</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)</li><li><div class="fn" />QObject <b><a href="qabstractitemmodel.html#parent-2">parent</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QModelIndex <b><a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeColumn">removeColumn</a></b> (<i>self</i>, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeColumns">removeColumns</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeRow">removeRow</a></b> (<i>self</i>, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeRows">removeRows</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;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" />dict-of-int-QByteArray <b><a href="qabstractitemmodel.html#roleNames">roleNames</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractitemmodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setData">setData</a></b> (<i>self</i>, QModelIndex, QVariant, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a></b> (<i>self</i>, int, Qt.Orientation, QVariant, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setItemData">setItemData</a></b> (<i>self</i>, QModelIndex, dict-of-int-QVariant)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#setRoleNames">setRoleNames</a></b> (<i>self</i>, dict-of-int-QByteArray)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a></b> (<i>self</i>, Qt.DropActions)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#sibling">sibling</a></b> (<i>self</i>, int, int, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#sort">sort</a></b> (<i>self</i>, int, Qt.SortOrder&#160;<i>order</i>&#160;=&#160;Qt.AscendingOrder)</li><li><div class="fn" />QSize <b><a href="qabstractitemmodel.html#span">span</a></b> (<i>self</i>, QModelIndex)</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#supportedDragActions">supportedDragActions</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#columnsAboutToBeInserted">columnsAboutToBeInserted</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsAboutToBeMoved">columnsAboutToBeMoved</a></b> (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsAboutToBeRemoved">columnsAboutToBeRemoved</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsInserted">columnsInserted</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsMoved">columnsMoved</a></b> (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsRemoved">columnsRemoved</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#dataChanged">dataChanged</a></b> (const QModelIndex&amp;,const QModelIndex&amp;)</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#layoutAboutToBeChanged">layoutAboutToBeChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#modelReset">modelReset</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeInserted">rowsAboutToBeInserted</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeMoved">rowsAboutToBeMoved</a></b> (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeRemoved">rowsAboutToBeRemoved</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsInserted">rowsInserted</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsMoved">rowsMoved</a></b> (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsRemoved">rowsRemoved</a></b> (const QModelIndex&amp;,int,int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractItemModel class provides the abstract interface for item model classes.</p>
11
 
<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>
12
 
<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>
13
 
<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>
14
 
<p>The underlying data model is exposed to views and delegates as a hierarchy of tables. If you do not 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>
15
 
<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. You can obtain this model index 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>
16
 
<p>Each item has a number of data elements associated with it and they 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>
17
 
<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>
18
 
<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>
19
 
<p>If an item has child objects, <a href="qabstractitemmodel.html#hasChildren">hasChildren</a>() returns true for the corresponding index.</p>
20
 
<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>
21
 
<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>
22
 
<p>The items available through the model can be searched for particular data using the <a href="qabstractitemmodel.html#match">match</a>() function.</p>
 
9
</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">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <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
 
10
item model classes. <a href="#details">More...</a></p>
 
11
 
 
12
<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="qfilesystemmodel.html">QFileSystemModel</a>, <a href="qhelpcontentmodel.html">QHelpContentModel</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&#160;<i>parent</i>&#160;=&#160;None)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a></b> (<i>self</i>, QModelIndex, int, int)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a></b> (<i>self</i>, QModelIndex, int, int)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#beginMoveColumns">beginMoveColumns</a></b> (<i>self</i>, QModelIndex, int, int, QModelIndex, int)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a></b> (<i>self</i>, QModelIndex, int, int, QModelIndex, int)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a></b> (<i>self</i>, QModelIndex, int, int)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a></b> (<i>self</i>, QModelIndex, int, int)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#buddy">buddy</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a></b> (<i>self</i>, QModelIndex, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#changePersistentIndexList">changePersistentIndexList</a></b> (<i>self</i>, list-of-QModelIndex, list-of-QModelIndex)</li><li><div class="fn" />int <b><a href="qabstractitemmodel.html#columnCount">columnCount</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#createIndex">createIndex</a></b> (<i>self</i>, int, int, object&#160;<i>object</i>&#160;=&#160;0)</li><li><div class="fn" />QVariant <b><a href="qabstractitemmodel.html#data">data</a></b> (<i>self</i>, QModelIndex, int&#160;<i>role</i>&#160;=&#160;Qt.DisplayRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#decodeData">decodeData</a></b> (<i>self</i>, int, int, QModelIndex, QDataStream)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a></b> (<i>self</i>, QMimeData, Qt.DropAction, int, int, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#encodeData">encodeData</a></b> (<i>self</i>, list-of-QModelIndex, QDataStream)</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#endMoveColumns">endMoveColumns</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#endMoveRows">endMoveRows</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#endResetModel">endResetModel</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#fetchMore">fetchMore</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />Qt.ItemFlags <b><a href="qabstractitemmodel.html#flags">flags</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#hasChildren">hasChildren</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#hasIndex">hasIndex</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />QVariant <b><a href="qabstractitemmodel.html#headerData">headerData</a></b> (<i>self</i>, int, Qt.Orientation, int&#160;<i>role</i>&#160;=&#160;Qt.DisplayRole)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#index">index</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertColumn">insertColumn</a></b> (<i>self</i>, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertColumns">insertColumns</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertRow">insertRow</a></b> (<i>self</i>, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#insertRows">insertRows</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />dict-of-int-QVariant <b><a href="qabstractitemmodel.html#itemData">itemData</a></b> (<i>self</i>, QModelIndex)</li><li><div class="fn" />list-of-QModelIndex <b><a href="qabstractitemmodel.html#match">match</a></b> (<i>self</i>, QModelIndex, int, QVariant, int&#160;<i>hits</i>&#160;=&#160;1, Qt.MatchFlags&#160;<i>flags</i>&#160;=&#160;Qt.MatchStartsWith|Qt.MatchWrap)</li><li><div class="fn" />QMimeData <b><a href="qabstractitemmodel.html#mimeData">mimeData</a></b> (<i>self</i>, list-of-QModelIndex)</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)</li><li><div class="fn" />QObject <b><a href="qabstractitemmodel.html#parent-2">parent</a></b> (<i>self</i>)</li><li><div class="fn" />list-of-QModelIndex <b><a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeColumn">removeColumn</a></b> (<i>self</i>, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeColumns">removeColumns</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeRow">removeRow</a></b> (<i>self</i>, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#removeRows">removeRows</a></b> (<i>self</i>, int, int, QModelIndex&#160;<i>parent</i>&#160;=&#160;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" />dict-of-int-QByteArray <b><a href="qabstractitemmodel.html#roleNames">roleNames</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qabstractitemmodel.html#rowCount">rowCount</a></b> (<i>self</i>, QModelIndex&#160;<i>parent</i>&#160;=&#160;QModelIndex())</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setData">setData</a></b> (<i>self</i>, QModelIndex, QVariant, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a></b> (<i>self</i>, int, Qt.Orientation, QVariant, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</li><li><div class="fn" />bool <b><a href="qabstractitemmodel.html#setItemData">setItemData</a></b> (<i>self</i>, QModelIndex, dict-of-int-QVariant)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#setRoleNames">setRoleNames</a></b> (<i>self</i>, dict-of-int-QByteArray)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a></b> (<i>self</i>, Qt.DropActions)</li><li><div class="fn" />QModelIndex <b><a href="qabstractitemmodel.html#sibling">sibling</a></b> (<i>self</i>, int, int, QModelIndex)</li><li><div class="fn" /><b><a href="qabstractitemmodel.html#sort">sort</a></b> (<i>self</i>, int, Qt.SortOrder&#160;<i>order</i>&#160;=&#160;Qt.AscendingOrder)</li><li><div class="fn" />QSize <b><a href="qabstractitemmodel.html#span">span</a></b> (<i>self</i>, QModelIndex)</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#supportedDragActions">supportedDragActions</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#columnsAboutToBeInserted">columnsAboutToBeInserted</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsAboutToBeMoved">columnsAboutToBeMoved</a></b> (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsAboutToBeRemoved">columnsAboutToBeRemoved</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsInserted">columnsInserted</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsMoved">columnsMoved</a></b> (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#columnsRemoved">columnsRemoved</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#dataChanged">dataChanged</a></b> (const QModelIndex&amp;,const QModelIndex&amp;)</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#layoutAboutToBeChanged">layoutAboutToBeChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#modelReset">modelReset</a></b> ()</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeInserted">rowsAboutToBeInserted</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeMoved">rowsAboutToBeMoved</a></b> (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsAboutToBeRemoved">rowsAboutToBeRemoved</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsInserted">rowsInserted</a></b> (const QModelIndex&amp;,int,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsMoved">rowsMoved</a></b> (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</li><li><div class="fn" />void <b><a href="qabstractitemmodel.html#rowsRemoved">rowsRemoved</a></b> (const QModelIndex&amp;,int,int)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QAbstractItemModel class provides the abstract interface for
 
13
item model classes.</p>
 
14
<p>The QAbstractItemModel class defines the standard interface that
 
15
item models must use to be able to interoperate with other
 
16
components in the model/view architecture. It is not supposed to be
 
17
instantiated directly. Instead, you should subclass it to create
 
18
new models.</p>
 
19
<p>The QAbstractItemModel class is one of the <a href="model-view.html">Model/View Classes</a> and is part of Qt's
 
20
<a href="model-view-programming.html">model/view framework</a>.</p>
 
21
<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
 
22
<a href="qabstractlistmodel.html">QAbstractListModel</a> or
 
23
<a href="qabstracttablemodel.html">QAbstractTableModel</a> instead
 
24
of this class.</p>
 
25
<p>The underlying data model is exposed to views and delegates as a
 
26
hierarchy of tables. If you do not make use of the hierarchy, then
 
27
the model is a simple table of rows and columns. Each item has a
 
28
unique index specified by a <a href="qmodelindex.html">QModelIndex</a>.</p>
 
29
<p class="centerAlign"><img src="images/modelindex-no-parent.png" /></p>
 
30
<p>Every item of data that can be accessed via a model has an
 
31
associated model index. You can obtain this model index using the
 
32
<a href="qabstractitemmodel.html#index">index</a>() function. Each
 
33
index may have a <a href="qabstractitemmodel.html#sibling">sibling</a>() index; child items
 
34
have a <a href="qabstractitemmodel.html#parent">parent</a>()
 
35
index.</p>
 
36
<p>Each item has a number of data elements associated with it and
 
37
they can be retrieved by specifying a role (see <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>) to the model's
 
38
<a href="qabstractitemmodel.html#data">data</a>() function. Data
 
39
for all available roles can be obtained at the same time using the
 
40
<a href="qabstractitemmodel.html#itemData">itemData</a>()
 
41
function.</p>
 
42
<p>Data for each role is set using a particular <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>. Data for
 
43
individual roles are set individually with <a href="qabstractitemmodel.html#setData">setData</a>(), or they can be set
 
44
for all roles with <a href="qabstractitemmodel.html#setItemData">setItemData</a>().</p>
 
45
<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
 
46
selected, dragged, or manipulated in other ways.</p>
 
47
<p>If an item has child objects, <a href="qabstractitemmodel.html#hasChildren">hasChildren</a>() returns
 
48
true for the corresponding index.</p>
 
49
<p>The model has a <a href="qabstractitemmodel.html#rowCount">rowCount</a>() and a <a href="qabstractitemmodel.html#columnCount">columnCount</a>() for each
 
50
level of the hierarchy. Rows and columns can be inserted and
 
51
removed with <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
 
52
<a href="qabstractitemmodel.html#removeRows">removeRows</a>(), and
 
53
<a href="qabstractitemmodel.html#removeColumns">removeColumns</a>().</p>
 
54
<p>The model emits signals to indicate changes. For example,
 
55
<a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() is
 
56
emitted whenever items of data made available by the model are
 
57
changed. Changes to the headers supplied by the model cause
 
58
<a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>()
 
59
to be emitted. If the structure of the underlying data changes, the
 
60
model can emit <a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>() to
 
61
indicate to any attached views that they should redisplay any items
 
62
shown, taking the new structure into account.</p>
 
63
<p>The items available through the model can be searched for
 
64
particular data using the <a href="qabstractitemmodel.html#match">match</a>() function.</p>
23
65
<p>To sort the model, you can use <a href="qabstractitemmodel.html#sort">sort</a>().</p>
24
 
<a name="subclassing" />
 
66
<a id="subclassing" name="subclassing" />
25
67
<h3>Subclassing</h3>
26
 
<p><b>Note:</b> Some general guidelines for subclassing models are available in the <a href="model-view-model-subclassing.html">Model Subclassing Reference</a>.</p>
27
 
<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>(). These functions are used in all read-only models, and form the basis of editable models.</p>
28
 
<p>You can also reimplement <a href="qabstractitemmodel.html#hasChildren">hasChildren</a>() to provide special behavior for models where the implementation of <a href="qabstractitemmodel.html#rowCount">rowCount</a>() is expensive. This makes it possible for models to restrict the amount of data requested by views, and can be used as a way to implement lazy population of model data.</p>
29
 
<p>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>
30
 
<p>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>
31
 
<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 an identifier for it, either as a pointer or as an integer value. The combination of these values must be unique for each item. 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 Example</a> for more information about unique identifiers.</p>
32
 
<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>
33
 
<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>
 
68
<p><b>Note:</b> Some general guidelines for subclassing models are
 
69
available in the <a href="model-view-programming.html#model-subclassing-reference">Model
 
70
Subclassing Reference</a>.</p>
 
71
<p>When subclassing QAbstractItemModel, at the very least you must
 
72
implement <a href="qabstractitemmodel.html#index">index</a>(),
 
73
<a href="qabstractitemmodel.html#parent">parent</a>(), <a href="qabstractitemmodel.html#rowCount">rowCount</a>(), <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), and
 
74
<a href="qabstractitemmodel.html#data">data</a>(). These functions
 
75
are used in all read-only models, and form the basis of editable
 
76
models.</p>
 
77
<p>You can also reimplement <a href="qabstractitemmodel.html#hasChildren">hasChildren</a>() to provide
 
78
special behavior for models where the implementation of <a href="qabstractitemmodel.html#rowCount">rowCount</a>() is expensive.
 
79
This makes it possible for models to restrict the amount of data
 
80
requested by views, and can be used as a way to implement lazy
 
81
population of model data.</p>
 
82
<p>To enable editing in your model, you must also implement
 
83
<a href="qabstractitemmodel.html#setData">setData</a>(), and
 
84
reimplement <a href="qabstractitemmodel.html#flags">flags</a>() to
 
85
ensure that <tt>ItemIsEditable</tt> is returned. You can also
 
86
reimplement <a href="qabstractitemmodel.html#headerData">headerData</a>() and <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>() to
 
87
control the way the headers for your model are presented.</p>
 
88
<p>The <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() and
 
89
<a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>()
 
90
signals must be emitted explicitly when reimplementing the <a href="qabstractitemmodel.html#setData">setData</a>() and <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>()
 
91
functions, respectively.</p>
 
92
<p>Custom models need to create model indexes for other components
 
93
to use. To do this, call <a href="qabstractitemmodel.html#createIndex">createIndex</a>() with
 
94
suitable row and column numbers for the item, and an identifier for
 
95
it, either as a pointer or as an integer value. The combination of
 
96
these values must be unique for each item. Custom models typically
 
97
use these unique identifiers in other reimplemented functions to
 
98
retrieve item data and access information about the item's parents
 
99
and children. See the <a href="itemviews-simpletreemodel.html">Simple Tree Model Example</a> for
 
100
more information about unique identifiers.</p>
 
101
<p>It is not necessary to support every role defined in <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>. Depending on the
 
102
type of data contained within a model, it may only be useful to
 
103
implement the <a href="qabstractitemmodel.html#data">data</a>()
 
104
function to return valid information for some of the more common
 
105
roles. Most models provide at least a textual representation of
 
106
item data for the <a href="qt.html#ItemDataRole-enum">Qt.DisplayRole</a>, and well-behaved
 
107
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
 
108
roles enables models to be used with standard Qt views. However,
 
109
for some models that handle highly-specialized data, it may be
 
110
appropriate to provide data only for user-defined roles.</p>
 
111
<p>Models that provide interfaces to resizable data structures can
 
112
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
 
113
<a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(). When
 
114
implementing these functions, it is important to notify any
 
115
connected views about changes to the model's dimensions both
 
116
<i>before</i> and <i>after</i> they occur:</p>
34
117
<ul>
35
 
<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 <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>() <i>immediately afterwards</i>.</li>
36
 
<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 <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>() <i>immediately afterwards</i>.</li>
37
 
<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 <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>() <i>immediately afterwards</i>.</li>
38
 
<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 <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>() <i>immediately afterwards</i>.</li>
 
118
<li>An <a href="qabstractitemmodel.html#insertRows">insertRows</a>()
 
119
implementation must call <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>()
 
120
<i>before</i> inserting new rows into the data structure, and
 
121
<a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>()
 
122
<i>immediately afterwards</i>.</li>
 
123
<li>An <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>()
 
124
implementation must call <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>()
 
125
<i>before</i> inserting new columns into the data structure, and
 
126
<a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>()
 
127
<i>immediately afterwards</i>.</li>
 
128
<li>A <a href="qabstractitemmodel.html#removeRows">removeRows</a>()
 
129
implementation must call <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>()
 
130
<i>before</i> the rows are removed from the data structure, and
 
131
<a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>()
 
132
<i>immediately afterwards</i>.</li>
 
133
<li>A <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>()
 
134
implementation must call <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>()
 
135
<i>before</i> the columns are removed from the data structure, and
 
136
<a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>()
 
137
<i>immediately afterwards</i>.</li>
39
138
</ul>
40
 
<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> If you insert or remove an item with children, you do not need to call these functions for the child items. In other words, the parent item will take care of its child items.</p>
41
 
<p>To create models that populate incrementally, you can reimplement <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>() and <a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a>(). If the reimplementation of <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>() adds rows to the model, <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows()</a> and <a href="qabstractitemmodel.html#endInsertRows">endInsertRows()</a> must be called.</p>
42
 
<p>See also <a href="model-view-model.html">Model Classes</a>, <a href="model-view-model-subclassing.html">Model Subclassing Reference</a>, <a href="qmodelindex.html">QModelIndex</a>, <a href="qabstractitemview.html">QAbstractItemView</a>, <a href="model-view-dnd.html">Using Drag and Drop with Item Views</a>, <a href="itemviews-simpledommodel.html">Simple DOM Model Example</a>, <a href="itemviews-simpletreemodel.html">Simple Tree Model Example</a>, <a href="itemviews-editabletreemodel.html">Editable Tree Model Example</a>, and <a href="itemviews-fetchmore.html">Fetch More Example</a>.</p>
43
 
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractItemModel" />QAbstractItemModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;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>
44
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/~QAbstractItemModel" />
 
139
<p>The <i>private</i> signals that these functions emit give
 
140
attached components the chance to take action before any data
 
141
becomes unavailable. The encapsulation of the insert and remove
 
142
operations with these begin and end functions also enables the
 
143
model to manage <a href="qpersistentmodelindex.html">persistent
 
144
model indexes</a> correctly. <b>If you want selections to be
 
145
handled properly, you must ensure that you call these
 
146
functions.</b> If you insert or remove an item with children, you
 
147
do not need to call these functions for the child items. In other
 
148
words, the parent item will take care of its child items.</p>
 
149
<p>To create models that populate incrementally, you can
 
150
reimplement <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>() and <a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a>(). If the
 
151
reimplementation of <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>() adds rows to
 
152
the model, <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows()</a> and
 
153
<a href="qabstractitemmodel.html#endInsertRows">endInsertRows()</a>
 
154
must be called.</p>
 
155
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QAbstractItemModel" />QAbstractItemModel.__init__ (<i>self</i>, <a href="qobject.html">QObject</a>&#160;<i>parent</i>&#160;=&#160;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
 
156
<i>parent</i>.</p>
 
157
 
 
158
 
45
159
<h3 class="fn"><a name="beginInsertColumns" />QAbstractItemModel.beginInsertColumns (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int, int)</h3><p>Begins a column insertion operation.</p>
46
 
<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>
47
 
<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 will have after they have been inserted.</p>
48
 
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="80%">
49
 
<tr class="odd" valign="top"><td><img alt="Inserting columns" src="images/modelview-begin-insert-columns.png" /></td><td>Specify the first and last column numbers for the span of columns you want to insert into an item in a model.<p>For example, as shown in the diagram, we insert three columns before column 4, so <i>first</i> is 4 and <i>last</i> is 6:</p>
50
 
<pre> beginInsertColumns(parent, 4, 6);</pre>
 
160
<p>When reimplementing <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() in a
 
161
subclass, you must call this function <i>before</i> inserting data
 
162
into the model's underlying data store.</p>
 
163
<p>The <i>parent</i> index corresponds to the parent into which the
 
164
new columns are inserted; <i>first</i> and <i>last</i> are the
 
165
column numbers of the new columns will have after they have been
 
166
inserted.</p>
 
167
<table class="generic">
 
168
<tr class="odd topAlign">
 
169
<td>
 
170
<p><img alt="Inserting columns" src="images/modelview-begin-insert-columns.png" /></p>
 
171
</td>
 
172
<td>
 
173
<p>Specify the first and last column numbers for the span of
 
174
columns you want to insert into an item in a model.</p>
 
175
<p>For example, as shown in the diagram, we insert three columns
 
176
before column 4, so <i>first</i> is 4 and <i>last</i> is 6:</p>
 
177
<pre class="highlightedCode brush: cpp">
 
178
 beginInsertColumns(parent, 4, 6);
 
179
</pre>
51
180
<p>This inserts the three new columns as columns 4, 5, and 6.</p>
52
 
</td></tr>
53
 
<tr class="even" valign="top"><td><img alt="Appending columns" src="images/modelview-begin-append-columns.png" /></td><td>To append columns, insert them after the last column.<p>For example, as shown in the diagram, we append three columns to a collection of six existing columns (ending in column 5), so <i>first</i> is 6 and <i>last</i> is 8:</p>
54
 
<pre> beginInsertColumns(parent, 6, 8);</pre>
 
181
</td>
 
182
</tr>
 
183
<tr class="even topAlign">
 
184
<td>
 
185
<p><img alt="Appending columns" src="images/modelview-begin-append-columns.png" /></p>
 
186
</td>
 
187
<td>
 
188
<p>To append columns, insert them after the last column.</p>
 
189
<p>For example, as shown in the diagram, we append three columns to
 
190
a collection of six existing columns (ending in column 5), so
 
191
<i>first</i> is 6 and <i>last</i> is 8:</p>
 
192
<pre class="highlightedCode brush: cpp">
 
193
 beginInsertColumns(parent, 6, 8);
 
194
</pre>
55
195
<p>This appends the two new columns as columns 6, 7, and 8.</p>
56
 
</td></tr>
57
 
</table></p>
58
 
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#columnsAboutToBeInserted">columnsAboutToBeInserted</a>() signal which connected views (or proxies) must handle before the data is inserted. Otherwise, the views may end up in an invalid state.</p>
 
196
</td>
 
197
</tr>
 
198
</table>
 
199
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#columnsAboutToBeInserted">columnsAboutToBeInserted</a>()
 
200
signal which connected views (or proxies) must handle before the
 
201
data is inserted. Otherwise, the views may end up in an invalid
 
202
state.</p>
59
203
<p>See also <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>().</p>
60
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/beginInsertRows" />
 
204
 
 
205
 
61
206
<h3 class="fn"><a name="beginInsertRows" />QAbstractItemModel.beginInsertRows (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int, int)</h3><p>Begins a row insertion operation.</p>
62
 
<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>
63
 
<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 that the new rows will have after they have been inserted.</p>
64
 
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="80%">
65
 
<tr class="odd" valign="top"><td><img alt="Inserting rows" src="images/modelview-begin-insert-rows.png" /></td><td>Specify the first and last row numbers for the span of rows you want to insert into an item in a model.<p>For example, as shown in the diagram, we insert three rows before row 2, so <i>first</i> is 2 and <i>last</i> is 4:</p>
66
 
<pre> beginInsertRows(parent, 2, 4);</pre>
 
207
<p>When reimplementing <a href="qabstractitemmodel.html#insertRows">insertRows</a>() in a
 
208
subclass, you must call this function <i>before</i> inserting data
 
209
into the model's underlying data store.</p>
 
210
<p>The <i>parent</i> index corresponds to the parent into which the
 
211
new rows are inserted; <i>first</i> and <i>last</i> are the row
 
212
numbers that the new rows will have after they have been
 
213
inserted.</p>
 
214
<table class="generic">
 
215
<tr class="odd topAlign">
 
216
<td>
 
217
<p><img alt="Inserting rows" src="images/modelview-begin-insert-rows.png" /></p>
 
218
</td>
 
219
<td>
 
220
<p>Specify the first and last row numbers for the span of rows you
 
221
want to insert into an item in a model.</p>
 
222
<p>For example, as shown in the diagram, we insert three rows
 
223
before row 2, so <i>first</i> is 2 and <i>last</i> is 4:</p>
 
224
<pre class="highlightedCode brush: cpp">
 
225
 beginInsertRows(parent, 2, 4);
 
226
</pre>
67
227
<p>This inserts the three new rows as rows 2, 3, and 4.</p>
68
 
</td></tr>
69
 
<tr class="even" valign="top"><td><img alt="Appending rows" src="images/modelview-begin-append-rows.png" /></td><td>To append rows, insert them after the last row.<p>For example, as shown in the diagram, we append two rows to a collection of 4 existing rows (ending in row 3), so <i>first</i> is 4 and <i>last</i> is 5:</p>
70
 
<pre> beginInsertRows(parent, 4, 5);</pre>
 
228
</td>
 
229
</tr>
 
230
<tr class="even topAlign">
 
231
<td>
 
232
<p><img alt="Appending rows" src="images/modelview-begin-append-rows.png" /></p>
 
233
</td>
 
234
<td>
 
235
<p>To append rows, insert them after the last row.</p>
 
236
<p>For example, as shown in the diagram, we append two rows to a
 
237
collection of 4 existing rows (ending in row 3), so <i>first</i> is
 
238
4 and <i>last</i> is 5:</p>
 
239
<pre class="highlightedCode brush: cpp">
 
240
 beginInsertRows(parent, 4, 5);
 
241
</pre>
71
242
<p>This appends the two new rows as rows 4 and 5.</p>
72
 
</td></tr>
73
 
</table></p>
74
 
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#rowsAboutToBeInserted">rowsAboutToBeInserted</a>() signal which connected views (or proxies) must handle before the data is inserted. Otherwise, the views may end up in an invalid state.</p>
 
243
</td>
 
244
</tr>
 
245
</table>
 
246
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#rowsAboutToBeInserted">rowsAboutToBeInserted</a>()
 
247
signal which connected views (or proxies) must handle before the
 
248
data is inserted. Otherwise, the views may end up in an invalid
 
249
state.</p>
75
250
<p>See also <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>().</p>
76
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/beginMoveColumns" />
 
251
 
 
252
 
77
253
<h3 class="fn"><a name="beginMoveColumns" />bool QAbstractItemModel.beginMoveColumns (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int, int, <a href="qmodelindex.html">QModelIndex</a>, int)</h3><p>Begins a column move operation.</p>
78
 
<p>When reimplementing a subclass, this method simplifies moving entities in your model. This method is responsible for moving persistent indexes in the model, which you would otherwise be required to do yourself.</p>
79
 
<p>Using beginMoveColumns and endMoveColumns is an alternative to emitting layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndexes. layoutAboutToBeChanged is emitted by this method for compatibility reasons.</p>
80
 
<p>The <i>sourceParent</i> index corresponds to the parent from which the columns are moved; <i>sourceFirst</i> and <i>sourceLast</i> are the column numbers of the columns to be moved. The <i>destinationParent</i> index corresponds to the parent into which the columns are moved. The <i>destinationChild</i> is the column to which the columns will be moved. That is, the index at column <i>sourceFirst</i> in <i>sourceParent</i> will become column <i>destinationChild</i> in <i>destinationParent</i>. Its siblings will be moved correspondingly.</p>
81
 
<p>Note that <i>sourceParent</i> and <i>destinationParent</i> may be the same, in which case you must ensure that the <i>destinationChild</i> is not within the range of <i>sourceFirst</i> and <i>sourceLast</i>. You must also ensure that you do not attempt to move a row to one of its own chilren or ancestors. This method returns false if either condition is true, in which case you should abort your move operation.</p>
 
254
<p>When reimplementing a subclass, this method simplifies moving
 
255
entities in your model. This method is responsible for moving
 
256
persistent indexes in the model, which you would otherwise be
 
257
required to do yourself. Using beginMoveRows and endMoveRows is an
 
258
alternative to emitting layoutAboutToBeChanged and layoutChanged
 
259
directly along with changePersistentIndexes. layoutAboutToBeChanged
 
260
is emitted by this method for compatibility reasons.</p>
 
261
<p>The <i>sourceParent</i> index corresponds to the parent from
 
262
which the columns are moved; <i>sourceFirst</i> and
 
263
<i>sourceLast</i> are the first and last column numbers of the
 
264
columns to be moved. The <i>destinationParent</i> index corresponds
 
265
to the parent into which those columns are moved. The
 
266
<i>destinationChild</i> is the column to which the columns will be
 
267
moved. That is, the index at column <i>sourceFirst</i> in
 
268
<i>sourceParent</i> will become column <i>destinationChild</i> in
 
269
<i>destinationParent</i>, followed by all other columns up to
 
270
<i>sourceLast</i>.</p>
 
271
<p>However, when moving columns down in the same parent
 
272
(<i>sourceParent</i> and <i>destinationParent</i> are equal), the
 
273
columnss will be placed before the <i>destinationChild</i> index.
 
274
That is, if you wish to move columns 0 and 1 so they will become
 
275
columns 1 and 2, <i>destinationChild</i> should be 3. In this case,
 
276
the new index for the source column <tt>i</tt> (which is between
 
277
<i>sourceFirst</i> and <i>sourceLast</i>) is equal to
 
278
<tt>(destinationChild-sourceLast-1+i)</tt>.</p>
 
279
<p>Note that if <i>sourceParent</i> and <i>destinationParent</i>
 
280
are the same, you must ensure that the <i>destinationChild</i> is
 
281
not within the range of <i>sourceFirst</i> and <i>sourceLast</i> +
 
282
1. You must also ensure that you do not attempt to move a column to
 
283
one of its own children or ancestors. This method returns false if
 
284
either condition is true, in which case you should abort your move
 
285
operation.</p>
82
286
<p>This function was introduced in Qt 4.6.</p>
83
287
<p>See also <a href="qabstractitemmodel.html#endMoveColumns">endMoveColumns</a>().</p>
84
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/beginMoveRows" />
 
288
 
 
289
 
85
290
<h3 class="fn"><a name="beginMoveRows" />bool QAbstractItemModel.beginMoveRows (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int, int, <a href="qmodelindex.html">QModelIndex</a>, int)</h3><p>Begins a row move operation.</p>
86
 
<p>When reimplementing a subclass, this method simplifies moving entities in your model. This method is responsible for moving persistent indexes in the model, which you would otherwise be required to do yourself.</p>
87
 
<p>Using beginMoveRows and endMoveRows is an alternative to emitting layoutAboutToBeChanged and layoutChanged directly along with changePersistentIndexes. layoutAboutToBeChanged is emitted by this method for compatibility reasons.</p>
88
 
<p>The <i>sourceParent</i> index corresponds to the parent from which the rows are moved; <i>sourceFirst</i> and <i>sourceLast</i> are the row numbers of the rows to be moved. The <i>destinationParent</i> index corresponds to the parent into which the rows are moved. The <i>destinationChild</i> is the row to which the rows will be moved. That is, the index at row <i>sourceFirst</i> in <i>sourceParent</i> will become row <i>destinationChild</i> in <i>destinationParent</i>. Its siblings will be moved correspondingly.</p>
89
 
<p>Note that <i>sourceParent</i> and <i>destinationParent</i> may be the same, in which case you must ensure that the <i>destinationChild</i> is not within the range of <i>sourceFirst</i> and <i>sourceLast</i>. You must also ensure that you do not attempt to move a row to one of its own chilren or ancestors. This method returns false if either condition is true, in which case you should abort your move operation.</p>
 
291
<p>When reimplementing a subclass, this method simplifies moving
 
292
entities in your model. This method is responsible for moving
 
293
persistent indexes in the model, which you would otherwise be
 
294
required to do yourself. Using beginMoveRows and endMoveRows is an
 
295
alternative to emitting layoutAboutToBeChanged and layoutChanged
 
296
directly along with changePersistentIndexes. layoutAboutToBeChanged
 
297
is emitted by this method for compatibility reasons.</p>
 
298
<p>The <i>sourceParent</i> index corresponds to the parent from
 
299
which the rows are moved; <i>sourceFirst</i> and <i>sourceLast</i>
 
300
are the first and last row numbers of the rows to be moved. The
 
301
<i>destinationParent</i> index corresponds to the parent into which
 
302
those rows are moved. The <i>destinationChild</i> is the row to
 
303
which the rows will be moved. That is, the index at row
 
304
<i>sourceFirst</i> in <i>sourceParent</i> will become row
 
305
<i>destinationChild</i> in <i>destinationParent</i>, followed by
 
306
all other rows up to <i>sourceLast</i>.</p>
 
307
<p>However, when moving rows down in the same parent
 
308
(<i>sourceParent</i> and <i>destinationParent</i> are equal), the
 
309
rows will be placed before the <i>destinationChild</i> index. That
 
310
is, if you wish to move rows 0 and 1 so they will become rows 1 and
 
311
2, <i>destinationChild</i> should be 3. In this case, the new index
 
312
for the source row <tt>i</tt> (which is between <i>sourceFirst</i>
 
313
and <i>sourceLast</i>) is equal to
 
314
<tt>(destinationChild-sourceLast-1+i)</tt>.</p>
 
315
<p>Note that if <i>sourceParent</i> and <i>destinationParent</i>
 
316
are the same, you must ensure that the <i>destinationChild</i> is
 
317
not within the range of <i>sourceFirst</i> and <i>sourceLast</i> +
 
318
1. You must also ensure that you do not attempt to move a row to
 
319
one of its own children or ancestors. This method returns false if
 
320
either condition is true, in which case you should abort your move
 
321
operation.</p>
 
322
<table class="generic">
 
323
<tr class="odd topAlign">
 
324
<td>
 
325
<p><img alt="Moving rows to another parent" src="images/modelview-move-rows-1.png" /></p>
 
326
</td>
 
327
<td>
 
328
<p>Specify the first and last row numbers for the span of rows in
 
329
the source parent you want to move in the model. Also specify the
 
330
row in the destination parent to move the span to.</p>
 
331
<p>For example, as shown in the diagram, we move three rows from
 
332
row 2 to 4 in the source, so <i>sourceFirst</i> is 2 and
 
333
<i>sourceLast</i> is 4. We move those items to above row 2 in the
 
334
destination, so <i>destinationRow</i> is 2.</p>
 
335
<pre class="highlightedCode brush: cpp">
 
336
 beginMoveRows(sourceParent, 2, 4, destinationParent, 2);
 
337
</pre>
 
338
<p>This moves the three rows rows 2, 3, and 4 in the source to
 
339
become 2, 3 and 4 in the destination. Other affected siblings are
 
340
displaced accordingly.</p>
 
341
</td>
 
342
</tr>
 
343
<tr class="even topAlign">
 
344
<td>
 
345
<p><img alt="Moving rows to append to another parent" src="images/modelview-move-rows-2.png" /></p>
 
346
</td>
 
347
<td>
 
348
<p>To append rows to another parent, move them to after the last
 
349
row.</p>
 
350
<p>For example, as shown in the diagram, we move three rows to a
 
351
collection of 6 existing rows (ending in row 5), so
 
352
<i>destinationStart</i> is 6:</p>
 
353
<pre class="highlightedCode brush: cpp">
 
354
 beginMoveRows(sourceParent, 2, 4, destinationParent, 6);
 
355
</pre>
 
356
<p>This moves the target rows to the end of the target parent as 6,
 
357
7 and 8.</p>
 
358
</td>
 
359
</tr>
 
360
<tr class="odd topAlign">
 
361
<td>
 
362
<p><img alt="Moving rows in the same parent up" src="images/modelview-move-rows-3.png" /></p>
 
363
</td>
 
364
<td>
 
365
<p>To move rows within the same parent, specify the row to move
 
366
them to.</p>
 
367
<p>For example, as shown in the diagram, we move one item from row
 
368
2 to row 0, so <i>sourceFirst</i> and <i>sourceLast</i> are 2 and
 
369
<i>destinationChild</i> is 0.</p>
 
370
<pre class="highlightedCode brush: cpp">
 
371
 beginMoveRows(parent, 2, 2, parent, 0);
 
372
</pre>
 
373
<p>Note that other rows may be displaced accordingly. Note also
 
374
that when moving items within the same parent you should not
 
375
attempt invalid or no-op moves. In the above example, item 2 is at
 
376
row 2 before the move, so it can not be moved to row 2 (where it is
 
377
already) or row 3 (no-op as row 3 means above row 3, where it is
 
378
already)</p>
 
379
</td>
 
380
</tr>
 
381
<tr class="even topAlign">
 
382
<td>
 
383
<p><img alt="Moving rows in the same parent down" src="images/modelview-move-rows-4.png" /></p>
 
384
</td>
 
385
<td>
 
386
<p>To move rows within the same parent, specify the row to move
 
387
them to.</p>
 
388
<p>For example, as shown in the diagram, we move one item from row
 
389
2 to row 4, so <i>sourceFirst</i> and <i>sourceLast</i> are 2 and
 
390
<i>destinationChild</i> is 4.</p>
 
391
<pre class="highlightedCode brush: cpp">
 
392
 beginMoveRows(parent, 2, 2, parent, 4);
 
393
</pre>
 
394
<p>Note that other rows may be displaced accordingly.</p>
 
395
</td>
 
396
</tr>
 
397
</table>
90
398
<p>This function was introduced in Qt 4.6.</p>
91
399
<p>See also <a href="qabstractitemmodel.html#endMoveRows">endMoveRows</a>().</p>
92
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/beginRemoveColumns" />
 
400
 
 
401
 
93
402
<h3 class="fn"><a name="beginRemoveColumns" />QAbstractItemModel.beginRemoveColumns (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int, int)</h3><p>Begins a column removal operation.</p>
94
 
<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>
95
 
<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 first and last columns to be removed.</p>
96
 
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="80%">
97
 
<tr class="odd" valign="top"><td><img alt="Removing columns" src="images/modelview-begin-remove-columns.png" /></td><td>Specify the first and last column numbers for the span of columns you want to remove from an item in a model.<p>For example, as shown in the diagram, we remove the three columns from column 4 to column 6, so <i>first</i> is 4 and <i>last</i> is 6:</p>
98
 
<pre> beginRemoveColumns(parent, 4, 6);</pre>
99
 
</td></tr>
100
 
</table></p>
101
 
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#columnsAboutToBeRemoved">columnsAboutToBeRemoved</a>() signal which connected views (or proxies) must handle before the data is removed. Otherwise, the views may end up in an invalid state.</p>
 
403
<p>When reimplementing <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() in a
 
404
subclass, you must call this function <i>before</i> removing data
 
405
from the model's underlying data store.</p>
 
406
<p>The <i>parent</i> index corresponds to the parent from which the
 
407
new columns are removed; <i>first</i> and <i>last</i> are the
 
408
column numbers of the first and last columns to be removed.</p>
 
409
<table class="generic">
 
410
<tr class="odd topAlign">
 
411
<td>
 
412
<p><img alt="Removing columns" src="images/modelview-begin-remove-columns.png" /></p>
 
413
</td>
 
414
<td>
 
415
<p>Specify the first and last column numbers for the span of
 
416
columns you want to remove from an item in a model.</p>
 
417
<p>For example, as shown in the diagram, we remove the three
 
418
columns from column 4 to column 6, so <i>first</i> is 4 and
 
419
<i>last</i> is 6:</p>
 
420
<pre class="highlightedCode brush: cpp">
 
421
 beginRemoveColumns(parent, 4, 6);
 
422
</pre></td>
 
423
</tr>
 
424
</table>
 
425
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#columnsAboutToBeRemoved">columnsAboutToBeRemoved</a>()
 
426
signal which connected views (or proxies) must handle before the
 
427
data is removed. Otherwise, the views may end up in an invalid
 
428
state.</p>
102
429
<p>See also <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>().</p>
103
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/beginRemoveRows" />
 
430
 
 
431
 
104
432
<h3 class="fn"><a name="beginRemoveRows" />QAbstractItemModel.beginRemoveRows (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int, int)</h3><p>Begins a row removal operation.</p>
105
 
<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>
106
 
<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>
107
 
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="80%">
108
 
<tr class="odd" valign="top"><td><img alt="Removing rows" src="images/modelview-begin-remove-rows.png" /></td><td>Specify the first and last row numbers for the span of rows you want to remove from an item in a model.<p>For example, as shown in the diagram, we remove the two rows from row 2 to row 3, so <i>first</i> is 2 and <i>last</i> is 3:</p>
109
 
<pre> beginRemoveRows(parent, 2, 3);</pre>
110
 
</td></tr>
111
 
</table></p>
112
 
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#rowsAboutToBeRemoved">rowsAboutToBeRemoved</a>() signal which connected views (or proxies) must handle before the data is removed. Otherwise, the views may end up in an invalid state.</p>
 
433
<p>When reimplementing <a href="qabstractitemmodel.html#removeRows">removeRows</a>() in a
 
434
subclass, you must call this function <i>before</i> removing data
 
435
from the model's underlying data store.</p>
 
436
<p>The <i>parent</i> index corresponds to the parent from which the
 
437
new rows are removed; <i>first</i> and <i>last</i> are the row
 
438
numbers of the rows to be removed.</p>
 
439
<table class="generic">
 
440
<tr class="odd topAlign">
 
441
<td>
 
442
<p><img alt="Removing rows" src="images/modelview-begin-remove-rows.png" /></p>
 
443
</td>
 
444
<td>
 
445
<p>Specify the first and last row numbers for the span of rows you
 
446
want to remove from an item in a model.</p>
 
447
<p>For example, as shown in the diagram, we remove the two rows
 
448
from row 2 to row 3, so <i>first</i> is 2 and <i>last</i> is 3:</p>
 
449
<pre class="highlightedCode brush: cpp">
 
450
 beginRemoveRows(parent, 2, 3);
 
451
</pre></td>
 
452
</tr>
 
453
</table>
 
454
<p><b>Note:</b> This function emits the <a href="qabstractitemmodel.html#rowsAboutToBeRemoved">rowsAboutToBeRemoved</a>()
 
455
signal which connected views (or proxies) must handle before the
 
456
data is removed. Otherwise, the views may end up in an invalid
 
457
state.</p>
113
458
<p>See also <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>().</p>
114
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/beginResetModel" />
 
459
 
 
460
 
115
461
<h3 class="fn"><a name="beginResetModel" />QAbstractItemModel.beginResetModel (<i>self</i>)</h3><p>Begins a model reset operation.</p>
116
 
<p>A reset operation resets the model to its current state in any attached views.</p>
117
 
<p><b>Note:</b> Any views attached to this model will be reset as well.</p>
118
 
<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. This also means that the current item and any selected items will become invalid.</p>
119
 
<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>
120
 
<p>You must call this function before resetting any internal data structures in your model or proxy model.</p>
 
462
<p>A reset operation resets the model to its current state in any
 
463
attached views.</p>
 
464
<p><b>Note:</b> Any views attached to this model will be reset as
 
465
well.</p>
 
466
<p>When a model is reset it means that any previous data reported
 
467
from the model is now invalid and has to be queried for again. This
 
468
also means that the current item and any selected items will become
 
469
invalid.</p>
 
470
<p>When a model radically changes its data it can sometimes be
 
471
easier to just call this function rather than emit <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() to inform
 
472
other components when the underlying data source, or its structure,
 
473
has changed.</p>
 
474
<p>You must call this function before resetting any internal data
 
475
structures in your model or proxy model.</p>
121
476
<p>This function was introduced in Qt 4.6.</p>
122
 
<p>See also <a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>(), <a href="qabstractitemmodel.html#modelReset">modelReset</a>(), and <a href="qabstractitemmodel.html#endResetModel">endResetModel</a>().</p>
123
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/buddy" />
124
 
<h3 class="fn"><a name="buddy" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.buddy (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</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. Then, the view will construct a delegate using the model index returned by the buddy item.</p>
125
 
<p>The default implementation of this function has each item as its own buddy.</p>
126
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/canFetchMore" />
127
 
<h3 class="fn"><a name="canFetchMore" />bool QAbstractItemModel.canFetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Returns true if there is more data available for <i>parent</i>; otherwise returns false.</p>
 
477
<p>See also <a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>(),
 
478
<a href="qabstractitemmodel.html#modelReset">modelReset</a>(), and
 
479
<a href="qabstractitemmodel.html#endResetModel">endResetModel</a>().</p>
 
480
 
 
481
 
 
482
<h3 class="fn"><a name="buddy" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.buddy (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Returns a model index for the buddy of the item represented by
 
483
<i>index</i>. When the user wants to edit an item, the view will
 
484
call this function to check whether another item in the model
 
485
should be edited instead. Then, the view will construct a delegate
 
486
using the model index returned by the buddy item.</p>
 
487
<p>The default implementation of this function has each item as its
 
488
own buddy.</p>
 
489
 
 
490
 
 
491
<h3 class="fn"><a name="canFetchMore" />bool QAbstractItemModel.canFetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Returns true if there is more data available for <i>parent</i>;
 
492
otherwise returns false.</p>
128
493
<p>The default implementation always returns false.</p>
129
 
<p>If canFetchMore() returns true, <a href="qabstractitemview.html">QAbstractItemView</a> will call <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>(). However, the <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>() function is only called when the model is being populated incrementally.</p>
 
494
<p>If canFetchMore() returns true, <a href="qabstractitemview.html">QAbstractItemView</a> will call <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>(). However, the
 
495
<a href="qabstractitemmodel.html#fetchMore">fetchMore</a>()
 
496
function is only called when the model is being populated
 
497
incrementally.</p>
130
498
<p>See also <a href="qabstractitemmodel.html#fetchMore">fetchMore</a>().</p>
131
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/changePersistentIndex" />
132
 
<h3 class="fn"><a name="changePersistentIndex" />QAbstractItemModel.changePersistentIndex (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, <a href="qmodelindex.html">QModelIndex</a>)</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>
133
 
<p>If no persistent model index equal to the given <i>from</i> model index was found, nothing is changed.</p>
134
 
<p>See also <a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a>() and <a href="qabstractitemmodel.html#changePersistentIndexList">changePersistentIndexList</a>().</p>
135
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/changePersistentIndexList" />
136
 
<h3 class="fn"><a name="changePersistentIndexList" />QAbstractItemModel.changePersistentIndexList (<i>self</i>, list-of-QModelIndex, list-of-QModelIndex)</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>
137
 
<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>
 
499
 
 
500
 
 
501
<h3 class="fn"><a name="changePersistentIndex" />QAbstractItemModel.changePersistentIndex (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Changes the <a href="qpersistentmodelindex.html">QPersistentModelIndex</a> that is
 
502
equal to the given <i>from</i> model index to the given <i>to</i>
 
503
model index.</p>
 
504
<p>If no persistent model index equal to the given <i>from</i>
 
505
model index was found, nothing is changed.</p>
 
506
<p>See also <a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a>()
 
507
and <a href="qabstractitemmodel.html#changePersistentIndexList">changePersistentIndexList</a>().</p>
 
508
 
 
509
 
 
510
<h3 class="fn"><a name="changePersistentIndexList" />QAbstractItemModel.changePersistentIndexList (<i>self</i>, list-of-QModelIndex, list-of-QModelIndex)</h3><p>Changes the QPersistentModelIndexes that is equal to the indexes
 
511
in the given <i>from</i> model index list to the given <i>to</i>
 
512
model index list.</p>
 
513
<p>If no persistent model indexes equal to the indexes in the given
 
514
<i>from</i> model index list was found, nothing is changed.</p>
138
515
<p>This function was introduced in Qt 4.1.</p>
139
 
<p>See also <a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a>() and <a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
140
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/columnCount" />
141
 
<h3 class="fn"><a name="columnCount" />int QAbstractItemModel.columnCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the number of columns for the children of the given <i>parent</i>.</p>
142
 
<p>In most subclasses, the number of columns is independent of the <i>parent</i>.</p>
 
516
<p>See also <a href="qabstractitemmodel.html#persistentIndexList">persistentIndexList</a>()
 
517
and <a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
 
518
 
 
519
 
 
520
<h3 class="fn"><a name="columnCount" />int QAbstractItemModel.columnCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the number of columns for the children of the given
 
521
<i>parent</i>.</p>
 
522
<p>In most subclasses, the number of columns is independent of the
 
523
<i>parent</i>.</p>
143
524
<p>For example:</p>
144
 
<pre> int DomModel.columnCount(const QModelIndex &amp;<span class="comment">/*parent*/</span>) const
 
525
<pre class="highlightedCode brush: cpp">
 
526
 int DomModel.columnCount(const QModelIndex &amp;<span class="comment">/*parent*/</span>) const
145
527
 {
146
528
     return 3;
147
 
 }</pre>
148
 
<p><b>Note:</b> When implementing a table based model, columnCount() should return 0 when the parent is valid.</p>
 
529
 }
 
530
</pre>
 
531
<p><b>Note:</b> When implementing a table based model,
 
532
columnCount() should return 0 when the parent is valid.</p>
149
533
<p>See also <a href="qabstractitemmodel.html#rowCount">rowCount</a>().</p>
150
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/columnsAboutToBeInserted" />
151
 
<h3 class="fn"><a name="createIndex" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.createIndex (<i>self</i>, int, int, object&#160;<i>object</i>&#160;=&#160;0)</h3><p>Creates a model index for the given <i>row</i> and <i>column</i> with the internal pointer <i>ptr</i>.</p>
152
 
<p>When using a <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a>, its indexes have their own internal pointer. It is not advisable to access this internal pointer outside of the model. Use the <a href="qabstractitemmodel.html#data">data</a>() function instead.</p>
153
 
<p>This function provides a consistent interface that model subclasses must use to create model indexes.</p>
154
 
<h3 class="fn"><a name="data" />QVariant QAbstractItemModel.data (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int&#160;<i>role</i>&#160;=&#160;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>
155
 
<p><b>Note:</b> If you do not have a value to return, return an <b>invalid</b> <a href="qvariant.html">QVariant</a> instead of returning 0.</p>
 
534
 
 
535
 
 
536
<h3 class="fn"><a name="createIndex" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.createIndex (<i>self</i>, int, int, object&#160;<i>object</i>&#160;=&#160;0)</h3><p>Creates a model index for the given <i>row</i> and <i>column</i>
 
537
with the internal pointer <i>ptr</i>.</p>
 
538
<p>When using a <a href="qsortfilterproxymodel.html">QSortFilterProxyModel</a>, its indexes
 
539
have their own internal pointer. It is not advisable to access this
 
540
internal pointer outside of the model. Use the <a href="qabstractitemmodel.html#data">data</a>() function instead.</p>
 
541
<p>This function provides a consistent interface that model
 
542
subclasses must use to create model indexes.</p>
 
543
 
 
544
 
 
545
<h3 class="fn"><a name="data" />QVariant QAbstractItemModel.data (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int&#160;<i>role</i>&#160;=&#160;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
 
546
referred to by the <i>index</i>.</p>
 
547
<p><b>Note:</b> If you do not have a value to return, return an
 
548
<b>invalid</b> <a href="qvariant.html">QVariant</a> instead of
 
549
returning 0.</p>
156
550
<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>
157
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/dataChanged" />
158
 
<h3 class="fn"><a name="decodeData" />bool QAbstractItemModel.decodeData (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>, <a href="qdatastream.html">QDataStream</a>)</h3><h3 class="fn"><a name="dropMimeData" />bool QAbstractItemModel.dropMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a>, <a href="qt.html#DropAction-enum">Qt.DropAction</a>, int, int, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Handles the <i>data</i> supplied by a drag and drop operation that ended with the given <i>action</i>.</p>
159
 
<p>Returns true if the data and action can be handled by the model; otherwise returns false.</p>
160
 
<p>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>
161
 
<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>
162
 
<p>When row and column are -1 it means that it is up to the model to decide where to place the data. This can occur in a tree when data is dropped on a parent. Models will usually append the data to the parent in this case.</p>
163
 
<p>See also <a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a>() and <a href="model-view-dnd.html">Using Drag and Drop with Item Views</a>.</p>
164
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/endInsertColumns" />
 
551
 
 
552
 
 
553
<h3 class="fn"><a name="decodeData" />bool QAbstractItemModel.decodeData (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>, <a href="qdatastream.html">QDataStream</a>)</h3><h3 class="fn"><a name="dropMimeData" />bool QAbstractItemModel.dropMimeData (<i>self</i>, <a href="qmimedata.html">QMimeData</a>, <a href="qt.html#DropAction-enum">Qt.DropAction</a>, int, int, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Handles the <i>data</i> supplied by a drag and drop operation
 
554
that ended with the given <i>action</i>.</p>
 
555
<p>Returns true if the data and action can be handled by the model;
 
556
otherwise returns false.</p>
 
557
<p>Although the specified <i>row</i>, <i>column</i> and
 
558
<i>parent</i> indicate the location of an item in the model where
 
559
the operation ended, it is the responsibility of the view to
 
560
provide a suitable location for where the data should be
 
561
inserted.</p>
 
562
<p>For instance, a drop action on an item in a <a href="qtreeview.html">QTreeView</a> can result in new items either being
 
563
inserted as children of the item specified by <i>row</i>,
 
564
<i>column</i>, and <i>parent</i>, or as siblings of the item.</p>
 
565
<p>When row and column are -1 it means that it is up to the model
 
566
to decide where to place the data. This can occur in a tree when
 
567
data is dropped on a parent. Models will usually append the data to
 
568
the parent in this case.</p>
 
569
<p>See also <a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a>()
 
570
and Using Drag and Drop with Item Views.</p>
 
571
 
 
572
 
165
573
<h3 class="fn"><a name="encodeData" />QAbstractItemModel.encodeData (<i>self</i>, list-of-QModelIndex, <a href="qdatastream.html">QDataStream</a>)</h3><h3 class="fn"><a name="endInsertColumns" />QAbstractItemModel.endInsertColumns (<i>self</i>)</h3><p>Ends a column insertion operation.</p>
166
 
<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>
 
574
<p>When reimplementing <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() in a
 
575
subclass, you must call this function <i>after</i> inserting data
 
576
into the model's underlying data store.</p>
167
577
<p>See also <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
168
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/endInsertRows" />
 
578
 
 
579
 
169
580
<h3 class="fn"><a name="endInsertRows" />QAbstractItemModel.endInsertRows (<i>self</i>)</h3><p>Ends a row insertion operation.</p>
170
 
<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>
 
581
<p>When reimplementing <a href="qabstractitemmodel.html#insertRows">insertRows</a>() in a
 
582
subclass, you must call this function <i>after</i> inserting data
 
583
into the model's underlying data store.</p>
171
584
<p>See also <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
172
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/endMoveColumns" />
 
585
 
 
586
 
173
587
<h3 class="fn"><a name="endMoveColumns" />QAbstractItemModel.endMoveColumns (<i>self</i>)</h3><p>Ends a column move operation.</p>
174
 
<p>When implementing a subclass, you must call this function <i>after</i> moving data within the model's underlying data store.</p>
175
 
<p>layoutChanged is emitted by this method for compatibility reasons.</p>
 
588
<p>When implementing a subclass, you must call this function
 
589
<i>after</i> moving data within the model's underlying data
 
590
store.</p>
 
591
<p>layoutChanged is emitted by this method for compatibility
 
592
reasons.</p>
176
593
<p>This function was introduced in Qt 4.6.</p>
177
594
<p>See also <a href="qabstractitemmodel.html#beginMoveColumns">beginMoveColumns</a>().</p>
178
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/endMoveRows" />
 
595
 
 
596
 
179
597
<h3 class="fn"><a name="endMoveRows" />QAbstractItemModel.endMoveRows (<i>self</i>)</h3><p>Ends a row move operation.</p>
180
 
<p>When implementing a subclass, you must call this function <i>after</i> moving data within the model's underlying data store.</p>
181
 
<p>layoutChanged is emitted by this method for compatibility reasons.</p>
 
598
<p>When implementing a subclass, you must call this function
 
599
<i>after</i> moving data within the model's underlying data
 
600
store.</p>
 
601
<p>layoutChanged is emitted by this method for compatibility
 
602
reasons.</p>
182
603
<p>This function was introduced in Qt 4.6.</p>
183
604
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
184
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/endRemoveColumns" />
 
605
 
 
606
 
185
607
<h3 class="fn"><a name="endRemoveColumns" />QAbstractItemModel.endRemoveColumns (<i>self</i>)</h3><p>Ends a column removal operation.</p>
186
 
<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>
 
608
<p>When reimplementing <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() in a
 
609
subclass, you must call this function <i>after</i> removing data
 
610
from the model's underlying data store.</p>
187
611
<p>See also <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
188
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/endRemoveRows" />
 
612
 
 
613
 
189
614
<h3 class="fn"><a name="endRemoveRows" />QAbstractItemModel.endRemoveRows (<i>self</i>)</h3><p>Ends a row removal operation.</p>
190
 
<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>
 
615
<p>When reimplementing <a href="qabstractitemmodel.html#removeRows">removeRows</a>() in a
 
616
subclass, you must call this function <i>after</i> removing data
 
617
from the model's underlying data store.</p>
191
618
<p>See also <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
192
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/endResetModel" />
 
619
 
 
620
 
193
621
<h3 class="fn"><a name="endResetModel" />QAbstractItemModel.endResetModel (<i>self</i>)</h3><p>Completes a model reset operation.</p>
194
 
<p>You must call this function after resetting any internal data structure in your model or proxy model.</p>
 
622
<p>You must call this function after resetting any internal data
 
623
structure in your model or proxy model.</p>
195
624
<p>This function was introduced in Qt 4.6.</p>
196
625
<p>See also <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>().</p>
197
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/fetchMore" />
198
 
<h3 class="fn"><a name="fetchMore" />QAbstractItemModel.fetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Fetches any available data for the items with the parent specified by the <i>parent</i> index.</p>
199
 
<p>Reimplement this if you are populating your model incrementally.</p>
 
626
 
 
627
 
 
628
<h3 class="fn"><a name="fetchMore" />QAbstractItemModel.fetchMore (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Fetches any available data for the items with the parent
 
629
specified by the <i>parent</i> index.</p>
 
630
<p>Reimplement this if you are populating your model
 
631
incrementally.</p>
200
632
<p>The default implementation does nothing.</p>
201
633
<p>See also <a href="qabstractitemmodel.html#canFetchMore">canFetchMore</a>().</p>
202
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/flags" />
 
634
 
 
635
 
203
636
<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>)</h3><p>Returns the item flags for the given <i>index</i>.</p>
204
 
<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>
 
637
<p>The base class implementation returns a combination of flags
 
638
that enables the item (<tt>ItemIsEnabled</tt>) and allows it to be
 
639
selected (<tt>ItemIsSelectable</tt>).</p>
205
640
<p>See also <a href="qt.html#ItemFlag-enum">Qt.ItemFlags</a>.</p>
206
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/hasChildren" />
207
 
<h3 class="fn"><a name="hasChildren" />bool QAbstractItemModel.hasChildren (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Returns true if <i>parent</i> has any children; otherwise returns false.</p>
208
 
<p>Use <a href="qabstractitemmodel.html#rowCount">rowCount</a>() on the parent to find out the number of children.</p>
209
 
<p>See also <a href="qabstractitemmodel.html#parent">parent</a>() and <a href="qabstractitemmodel.html#index">index</a>().</p>
210
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/hasIndex" />
211
 
<h3 class="fn"><a name="hasIndex" />bool QAbstractItemModel.hasIndex (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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>
212
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/headerData" />
213
 
<h3 class="fn"><a name="headerData" />QVariant QAbstractItemModel.headerData (<i>self</i>, int, <a href="qt.html#Orientation-enum">Qt.Orientation</a>, int&#160;<i>role</i>&#160;=&#160;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>
214
 
<p>For horizontal headers, the section number corresponds to the column number. Similarly, for vertical headers, the section number corresponds to the row number.</p>
215
 
<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>
216
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/headerDataChanged" />
217
 
<h3 class="fn"><a name="index" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.index (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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>
218
 
<p>When reimplementing this function in a subclass, call <a href="qabstractitemmodel.html#createIndex">createIndex</a>() to generate model indexes that other components can use to refer to items in your model.</p>
 
641
 
 
642
 
 
643
<h3 class="fn"><a name="hasChildren" />bool QAbstractItemModel.hasChildren (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Returns true if <i>parent</i> has any children; otherwise
 
644
returns false.</p>
 
645
<p>Use <a href="qabstractitemmodel.html#rowCount">rowCount</a>() on
 
646
the parent to find out the number of children.</p>
 
647
<p>See also <a href="qabstractitemmodel.html#parent">parent</a>()
 
648
and <a href="qabstractitemmodel.html#index">index</a>().</p>
 
649
 
 
650
 
 
651
<h3 class="fn"><a name="hasIndex" />bool QAbstractItemModel.hasIndex (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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>
 
652
with <i>parent</i>, otherwise returns false.</p>
 
653
 
 
654
 
 
655
<h3 class="fn"><a name="headerData" />QVariant QAbstractItemModel.headerData (<i>self</i>, int, <a href="qt.html#Orientation-enum">Qt.Orientation</a>, int&#160;<i>role</i>&#160;=&#160;Qt.DisplayRole)</h3><p>Returns the data for the given <i>role</i> and <i>section</i> in
 
656
the header with the specified <i>orientation</i>.</p>
 
657
<p>For horizontal headers, the section number corresponds to the
 
658
column number. Similarly, for vertical headers, the section number
 
659
corresponds to the row number.</p>
 
660
<p>See also <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>, <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>(), and
 
661
<a href="qheaderview.html">QHeaderView</a>.</p>
 
662
 
 
663
 
 
664
<h3 class="fn"><a name="index" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.index (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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
 
665
given <i>row</i>, <i>column</i> and <i>parent</i> index.</p>
 
666
<p>When reimplementing this function in a subclass, call <a href="qabstractitemmodel.html#createIndex">createIndex</a>() to generate
 
667
model indexes that other components can use to refer to items in
 
668
your model.</p>
219
669
<p>See also <a href="qabstractitemmodel.html#createIndex">createIndex</a>().</p>
220
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/insertColumn" />
221
 
<h3 class="fn"><a name="insertColumn" />bool QAbstractItemModel.insertColumn (<i>self</i>, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Inserts a single column before the given <i>column</i> in the child items of the <i>parent</i> specified.</p>
222
 
<p>Returns true if the column is inserted; otherwise returns false.</p>
223
 
<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>
224
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/insertColumns" />
225
 
<h3 class="fn"><a name="insertColumns" />bool QAbstractItemModel.insertColumns (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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>
226
 
<p>If <i>column</i> is 0, the columns are prepended to any existing columns.</p>
227
 
<p>If <i>column</i> is <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), the columns are appended to any existing columns.</p>
228
 
<p>If <i>parent</i> has no children, a single row with <i>count</i> columns is inserted.</p>
229
 
<p>Returns true if the columns were successfully inserted; otherwise returns false.</p>
230
 
<p>The base class implementation does nothing and returns false.</p>
231
 
<p>If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide your own API for altering the data.</p>
232
 
<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>
233
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/insertRow" />
234
 
<h3 class="fn"><a name="insertRow" />bool QAbstractItemModel.insertRow (<i>self</i>, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p><b>Note:</b> The base class implementation of this function does nothing and returns false.</p>
235
 
<p>Inserts a single row before the given <i>row</i> in the child items of the <i>parent</i> specified.</p>
236
 
<p>Returns true if the row is inserted; otherwise returns false.</p>
237
 
<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>
238
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/insertRows" />
239
 
<h3 class="fn"><a name="insertRows" />bool QAbstractItemModel.insertRows (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p><b>Note:</b> The base class implementation of this function does nothing and returns false.</p>
240
 
<p>On models that support this, inserts <i>count</i> rows into the model before the given <i>row</i>. Items in the new row will be children of the item represented by the <i>parent</i> model index.</p>
241
 
<p>If <i>row</i> is 0, the rows are prepended to any existing rows in the parent.</p>
242
 
<p>If <i>row</i> is <a href="qabstractitemmodel.html#rowCount">rowCount</a>(), the rows are appended to any existing rows in the parent.</p>
243
 
<p>If <i>parent</i> has no children, a single column with <i>count</i> rows is inserted.</p>
244
 
<p>Returns true if the rows were successfully inserted; otherwise returns false.</p>
245
 
<p>If you implement your own model, you can reimplement this function if you want to support insertions. Alternatively, you can provide your own API for altering the data. In either case, you will need to call <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>() and <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>() to notify other components that the model has changed.</p>
246
 
<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>
247
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/itemData" />
248
 
<h3 class="fn"><a name="itemData" />dict-of-int-QVariant QAbstractItemModel.itemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Returns a map with values for all predefined roles in the model for the item at the given <i>index</i>.</p>
249
 
<p>Reimplement this function if you want to extend the default behavior of this function to include custom roles in the map.</p>
 
670
 
 
671
 
 
672
<h3 class="fn"><a name="insertColumn" />bool QAbstractItemModel.insertColumn (<i>self</i>, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Inserts a single column before the given <i>column</i> in the
 
673
child items of the <i>parent</i> specified.</p>
 
674
<p>Returns true if the column is inserted; otherwise returns
 
675
false.</p>
 
676
<p>See also <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
 
677
<a href="qabstractitemmodel.html#insertRow">insertRow</a>(), and
 
678
<a href="qabstractitemmodel.html#removeColumn">removeColumn</a>().</p>
 
679
 
 
680
 
 
681
<h3 class="fn"><a name="insertColumns" />bool QAbstractItemModel.insertColumns (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>On models that support this, inserts <i>count</i> new columns
 
682
into the model before the given <i>column</i>. The items in each
 
683
new column will be children of the item represented by the
 
684
<i>parent</i> model index.</p>
 
685
<p>If <i>column</i> is 0, the columns are prepended to any existing
 
686
columns.</p>
 
687
<p>If <i>column</i> is <a href="qabstractitemmodel.html#columnCount">columnCount</a>(), the
 
688
columns are appended to any existing columns.</p>
 
689
<p>If <i>parent</i> has no children, a single row with <i>count</i>
 
690
columns is inserted.</p>
 
691
<p>Returns true if the columns were successfully inserted;
 
692
otherwise returns false.</p>
 
693
<p>The base class implementation does nothing and returns
 
694
false.</p>
 
695
<p>If you implement your own model, you can reimplement this
 
696
function if you want to support insertions. Alternatively, you can
 
697
provide your own API for altering the data.</p>
 
698
<p>See also <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(),
 
699
<a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>(),
 
700
and <a href="qabstractitemmodel.html#endInsertColumns">endInsertColumns</a>().</p>
 
701
 
 
702
 
 
703
<h3 class="fn"><a name="insertRow" />bool QAbstractItemModel.insertRow (<i>self</i>, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p><b>Note:</b> The base class implementation of this function does
 
704
nothing and returns false.</p>
 
705
<p>Inserts a single row before the given <i>row</i> in the child
 
706
items of the <i>parent</i> specified.</p>
 
707
<p>Returns true if the row is inserted; otherwise returns
 
708
false.</p>
 
709
<p>See also <a href="qabstractitemmodel.html#insertRows">insertRows</a>(), <a href="qabstractitemmodel.html#insertColumn">insertColumn</a>(), and
 
710
<a href="qabstractitemmodel.html#removeRow">removeRow</a>().</p>
 
711
 
 
712
 
 
713
<h3 class="fn"><a name="insertRows" />bool QAbstractItemModel.insertRows (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p><b>Note:</b> The base class implementation of this function does
 
714
nothing and returns false.</p>
 
715
<p>On models that support this, inserts <i>count</i> rows into the
 
716
model before the given <i>row</i>. Items in the new row will be
 
717
children of the item represented by the <i>parent</i> model
 
718
index.</p>
 
719
<p>If <i>row</i> is 0, the rows are prepended to any existing rows
 
720
in the parent.</p>
 
721
<p>If <i>row</i> is <a href="qabstractitemmodel.html#rowCount">rowCount</a>(), the rows are
 
722
appended to any existing rows in the parent.</p>
 
723
<p>If <i>parent</i> has no children, a single column with
 
724
<i>count</i> rows is inserted.</p>
 
725
<p>Returns true if the rows were successfully inserted; otherwise
 
726
returns false.</p>
 
727
<p>If you implement your own model, you can reimplement this
 
728
function if you want to support insertions. Alternatively, you can
 
729
provide your own API for altering the data. In either case, you
 
730
will need to call <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>() and
 
731
<a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>()
 
732
to notify other components that the model has changed.</p>
 
733
<p>See also <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
 
734
<a href="qabstractitemmodel.html#removeRows">removeRows</a>(),
 
735
<a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>(),
 
736
and <a href="qabstractitemmodel.html#endInsertRows">endInsertRows</a>().</p>
 
737
 
 
738
 
 
739
<h3 class="fn"><a name="itemData" />dict-of-int-QVariant QAbstractItemModel.itemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Returns a map with values for all predefined roles in the model
 
740
for the item at the given <i>index</i>.</p>
 
741
<p>Reimplement this function if you want to extend the default
 
742
behavior of this function to include custom roles in the map.</p>
250
743
<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>
251
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/layoutAboutToBeChanged" />
252
 
<h3 class="fn"><a name="match" />list-of-QModelIndex QAbstractItemModel.match (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int, QVariant, int&#160;<i>hits</i>&#160;=&#160;1, <a href="qt-matchflags.html">Qt.MatchFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.MatchStartsWith|Qt.MatchWrap)</h3><p>Returns a list of indexes for the items in the column of the <i>start</i> index where 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>
253
 
<p>The search begins 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>. If you want to search for all matching items, use <i>hits</i> = -1.</p>
254
 
<p>By default, this function will perform a wrapping, string-based comparison on all items, searching for items that begin with the search term specified by <i>value</i>.</p>
255
 
<p><b>Note:</b> The default implementation of this function only searches columns. Reimplement this function to include a different search behavior.</p>
256
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/mimeData" />
257
 
<h3 class="fn"><a name="mimeData" /><a href="qmimedata.html">QMimeData</a> QAbstractItemModel.mimeData (<i>self</i>, list-of-QModelIndex)</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>
258
 
<p>If the list of indexes is empty, or there are no supported MIME types, 0 is returned rather than a serialized empty list.</p>
 
744
 
 
745
 
 
746
<h3 class="fn"><a name="match" />list-of-QModelIndex QAbstractItemModel.match (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, int, QVariant, int&#160;<i>hits</i>&#160;=&#160;1, <a href="qt-matchflags.html">Qt.MatchFlags</a>&#160;<i>flags</i>&#160;=&#160;Qt.MatchStartsWith|Qt.MatchWrap)</h3><p>Returns a list of indexes for the items in the column of the
 
747
<i>start</i> index where data stored under the given <i>role</i>
 
748
matches the specified <i>value</i>. The way the search is performed
 
749
is defined by the <i>flags</i> given. The list that is returned may
 
750
be empty.</p>
 
751
<p>The search begins from the <i>start</i> index, and continues
 
752
until the number of matching data items equals <i>hits</i>, the
 
753
search reaches the last row, or the search reaches <i>start</i>
 
754
again - depending on whether <tt>MatchWrap</tt> is specified in
 
755
<i>flags</i>. If you want to search for all matching items, use
 
756
<i>hits</i> = -1.</p>
 
757
<p>By default, this function will perform a wrapping, string-based
 
758
comparison on all items, searching for items that begin with the
 
759
search term specified by <i>value</i>.</p>
 
760
<p><b>Note:</b> The default implementation of this function only
 
761
searches columns. Reimplement this function to include a different
 
762
search behavior.</p>
 
763
 
 
764
 
 
765
<h3 class="fn"><a name="mimeData" /><a href="qmimedata.html">QMimeData</a> QAbstractItemModel.mimeData (<i>self</i>, list-of-QModelIndex)</h3><p>The <i>QMimeData</i> result</p><p>Returns an object that contains serialized items of data
 
766
corresponding to the list of <i>indexes</i> specified. The formats
 
767
used to describe the encoded data is obtained from the <a href="qabstractitemmodel.html#mimeTypes">mimeTypes</a>() function.</p>
 
768
<p>If the list of indexes is empty, or there are no supported MIME
 
769
types, 0 is returned rather than a serialized empty list.</p>
259
770
<p>See also <a href="qabstractitemmodel.html#mimeTypes">mimeTypes</a>() and <a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a>().</p>
260
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/mimeTypes" />
261
 
<h3 class="fn"><a name="mimeTypes" />QStringList 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>
 
771
 
 
772
 
 
773
<h3 class="fn"><a name="mimeTypes" />QStringList QAbstractItemModel.mimeTypes (<i>self</i>)</h3><p>Returns a list of MIME types that can be used to describe a list
 
774
of model indexes.</p>
262
775
<p>See also <a href="qabstractitemmodel.html#mimeData">mimeData</a>().</p>
263
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/modelAboutToBeReset" />
264
 
<h3 class="fn"><a name="parent" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.parent (<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>Returns the parent of the model item with the given <i>index</i>. If the model has no parent, an invalid <a href="qmodelindex.html">QModelIndex</a> is returned.</p>
265
 
<p>A common convention used in models that expose tree data structures is that only items in the first column have children. For that case, when reimplementing this function in a subclass the column of the returned <a href="qmodelindex.html">QModelIndex</a> would be 0.</p>
266
 
<p>When reimplementing this function in a subclass, be careful to avoid calling <a href="qmodelindex.html">QModelIndex</a> member functions, such as <a href="qmodelindex.html#parent">QModelIndex.parent</a>(), since indexes belonging to your model will simply call your implementation, leading to infinite recursion.</p>
 
776
 
 
777
 
 
778
<h3 class="fn"><a name="parent" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.parent (<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>Returns the parent of the model item with the given
 
779
<i>index</i>. If the item has no parent, an invalid <a href="qmodelindex.html">QModelIndex</a> is returned.</p>
 
780
<p>A common convention used in models that expose tree data
 
781
structures is that only items in the first column have children.
 
782
For that case, when reimplementing this function in a subclass the
 
783
column of the returned <a href="qmodelindex.html">QModelIndex</a>
 
784
would be 0.</p>
 
785
<p>When reimplementing this function in a subclass, be careful to
 
786
avoid calling <a href="qmodelindex.html">QModelIndex</a> member
 
787
functions, such as <a href="qmodelindex.html#parent">QModelIndex.parent</a>(), since indexes
 
788
belonging to your model will simply call your implementation,
 
789
leading to infinite recursion.</p>
267
790
<p>See also <a href="qabstractitemmodel.html#createIndex">createIndex</a>().</p>
268
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/persistentIndexList" />
269
 
<h3 class="fn"><a name="parent-2" /><a href="qobject.html">QObject</a> QAbstractItemModel.parent (<i>self</i>)</h3><h3 class="fn"><a name="persistentIndexList" />list-of-QModelIndex QAbstractItemModel.persistentIndexList (<i>self</i>)</h3><p>Returns the list of indexes stored as persistent indexes in the model.</p>
 
791
 
 
792
 
 
793
<h3 class="fn"><a name="parent-2" /><a href="qobject.html">QObject</a> QAbstractItemModel.parent (<i>self</i>)</h3><h3 class="fn"><a name="persistentIndexList" />list-of-QModelIndex QAbstractItemModel.persistentIndexList (<i>self</i>)</h3><p>Returns the list of indexes stored as persistent indexes in the
 
794
model.</p>
270
795
<p>This function was introduced in Qt 4.2.</p>
271
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/removeColumn" />
272
 
<h3 class="fn"><a name="removeColumn" />bool QAbstractItemModel.removeColumn (<i>self</i>, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Removes the given <i>column</i> from the child items of the <i>parent</i> specified.</p>
273
 
<p>Returns true if the column is removed; otherwise returns false.</p>
274
 
<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>
275
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/removeColumns" />
276
 
<h3 class="fn"><a name="removeColumns" />bool QAbstractItemModel.removeColumns (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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.</p>
277
 
<p>Returns true if the columns were successfully removed; otherwise returns false.</p>
278
 
<p>The base class implementation does nothing and returns false.</p>
279
 
<p>If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide your own API for altering the data.</p>
280
 
<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>
281
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/removeRow" />
282
 
<h3 class="fn"><a name="removeRow" />bool QAbstractItemModel.removeRow (<i>self</i>, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Removes the given <i>row</i> from the child items of the <i>parent</i> specified.</p>
 
796
 
 
797
 
 
798
<h3 class="fn"><a name="removeColumn" />bool QAbstractItemModel.removeColumn (<i>self</i>, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Removes the given <i>column</i> from the child items of the
 
799
<i>parent</i> specified.</p>
 
800
<p>Returns true if the column is removed; otherwise returns
 
801
false.</p>
 
802
<p>See also <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(),
 
803
<a href="qabstractitemmodel.html#removeRow">removeRow</a>(), and
 
804
<a href="qabstractitemmodel.html#insertColumn">insertColumn</a>().</p>
 
805
 
 
806
 
 
807
<h3 class="fn"><a name="removeColumns" />bool QAbstractItemModel.removeColumns (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>On models that support this, removes <i>count</i> columns
 
808
starting with the given <i>column</i> under parent <i>parent</i>
 
809
from the model.</p>
 
810
<p>Returns true if the columns were successfully removed; otherwise
 
811
returns false.</p>
 
812
<p>The base class implementation does nothing and returns
 
813
false.</p>
 
814
<p>If you implement your own model, you can reimplement this
 
815
function if you want to support removing. Alternatively, you can
 
816
provide your own API for altering the data.</p>
 
817
<p>See also <a href="qabstractitemmodel.html#removeColumn">removeColumn</a>(), <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
 
818
<a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>(),
 
819
and <a href="qabstractitemmodel.html#endRemoveColumns">endRemoveColumns</a>().</p>
 
820
 
 
821
 
 
822
<h3 class="fn"><a name="removeRow" />bool QAbstractItemModel.removeRow (<i>self</i>, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>Removes the given <i>row</i> from the child items of the
 
823
<i>parent</i> specified.</p>
283
824
<p>Returns true if the row is removed; otherwise returns false.</p>
284
 
<p>This is a convenience function that calls <a href="qabstractitemmodel.html#removeRows">removeRows</a>(). The <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation of <a href="qabstractitemmodel.html#removeRows">removeRows</a>() does nothing.</p>
285
 
<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>
286
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/removeRows" />
287
 
<h3 class="fn"><a name="removeRows" />bool QAbstractItemModel.removeRows (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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.</p>
288
 
<p>Returns true if the rows were successfully removed; otherwise returns false.</p>
289
 
<p>The base class implementation does nothing and returns false.</p>
290
 
<p>If you implement your own model, you can reimplement this function if you want to support removing. Alternatively, you can provide your own API for altering the data.</p>
291
 
<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>
292
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/reset" />
293
 
<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>
294
 
<p><b>Note:</b> Use <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() and <a href="qabstractitemmodel.html#endResetModel">endResetModel</a>() instead whenever possible. Use this method only if there is no way to call <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() before invalidating the model. Otherwise it could lead to unexcpected behaviour, especially when used with proxy models.</p>
295
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/revert" />
296
 
<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>Lets the model know that it should discard cached information. This function is typically used for row editing.</p>
 
825
<p>This is a convenience function that calls <a href="qabstractitemmodel.html#removeRows">removeRows</a>(). The <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation of
 
826
<a href="qabstractitemmodel.html#removeRows">removeRows</a>() does
 
827
nothing.</p>
 
828
<p>See also <a href="qabstractitemmodel.html#removeRows">removeRows</a>(), <a href="qabstractitemmodel.html#removeColumn">removeColumn</a>(), and
 
829
<a href="qabstractitemmodel.html#insertRow">insertRow</a>().</p>
 
830
 
 
831
 
 
832
<h3 class="fn"><a name="removeRows" />bool QAbstractItemModel.removeRows (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;QModelIndex())</h3><p>On models that support this, removes <i>count</i> rows starting
 
833
with the given <i>row</i> under parent <i>parent</i> from the
 
834
model.</p>
 
835
<p>Returns true if the rows were successfully removed; otherwise
 
836
returns false.</p>
 
837
<p>The base class implementation does nothing and returns
 
838
false.</p>
 
839
<p>If you implement your own model, you can reimplement this
 
840
function if you want to support removing. Alternatively, you can
 
841
provide your own API for altering the data.</p>
 
842
<p>See also <a href="qabstractitemmodel.html#removeRow">removeRow</a>(), <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>(),
 
843
<a href="qabstractitemmodel.html#insertColumns">insertColumns</a>(),
 
844
<a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>(),
 
845
and <a href="qabstractitemmodel.html#endRemoveRows">endRemoveRows</a>().</p>
 
846
 
 
847
 
 
848
<h3 class="fn"><a name="reset" />QAbstractItemModel.reset (<i>self</i>)</h3><p>Resets the model to its original state in any attached
 
849
views.</p>
 
850
<p><b>Note:</b> Use <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() and
 
851
<a href="qabstractitemmodel.html#endResetModel">endResetModel</a>()
 
852
instead whenever possible. Use this method only if there is no way
 
853
to call <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>()
 
854
before invalidating the model. Otherwise it could lead to
 
855
unexpected behaviour, especially when used with proxy models.</p>
 
856
 
 
857
 
 
858
<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>Lets the model know that it should discard cached information.
 
859
This function is typically used for row editing.</p>
297
860
<p>See also <a href="qabstractitemmodel.html#submit">submit</a>().</p>
298
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/roleNames" />
 
861
 
 
862
 
299
863
<h3 class="fn"><a name="roleNames" />dict-of-int-QByteArray QAbstractItemModel.roleNames (<i>self</i>)</h3><p>Returns the model's role names.</p>
300
864
<p>This function was introduced in Qt 4.6.</p>
301
865
<p>See also <a href="qabstractitemmodel.html#setRoleNames">setRoleNames</a>().</p>
302
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/rowCount" />
303
 
<h3 class="fn"><a name="rowCount" />int QAbstractItemModel.rowCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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>. When the parent is valid it means that rowCount is returning the number of children of parent.</p>
304
 
<p><b>Note:</b> When implementing a table based model, rowCount() should return 0 when the parent is valid.</p>
 
866
 
 
867
 
 
868
<h3 class="fn"><a name="rowCount" />int QAbstractItemModel.rowCount (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>parent</i>&#160;=&#160;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>. When
 
869
the parent is valid it means that rowCount is returning the number
 
870
of children of parent.</p>
 
871
<p><b>Note:</b> When implementing a table based model, rowCount()
 
872
should return 0 when the parent is valid.</p>
305
873
<p>See also <a href="qabstractitemmodel.html#columnCount">columnCount</a>().</p>
306
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/rowsAboutToBeInserted" />
307
 
<h3 class="fn"><a name="setData" />bool QAbstractItemModel.setData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, QVariant, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</h3><p>Sets the <i>role</i> data for the item at <i>index</i> to <i>value</i>.</p>
 
874
 
 
875
 
 
876
<h3 class="fn"><a name="setData" />bool QAbstractItemModel.setData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, QVariant, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</h3><p>Sets the <i>role</i> data for the item at <i>index</i> to
 
877
<i>value</i>.</p>
308
878
<p>Returns true if successful; otherwise returns false.</p>
309
 
<p>The <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() signal should be emitted if the data was successfully set.</p>
310
 
<p>The base class implementation returns false. This function and <a href="qabstractitemmodel.html#data">data</a>() must be reimplemented for editable models.</p>
 
879
<p>The <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>() signal
 
880
should be emitted if the data was successfully set.</p>
 
881
<p>The base class implementation returns false. This function and
 
882
<a href="qabstractitemmodel.html#data">data</a>() must be
 
883
reimplemented for editable models.</p>
311
884
<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>
312
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/setHeaderData" />
313
 
<h3 class="fn"><a name="setHeaderData" />bool QAbstractItemModel.setHeaderData (<i>self</i>, int, <a href="qt.html#Orientation-enum">Qt.Orientation</a>, QVariant, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</h3><p>Sets the data for the given <i>role</i> and <i>section</i> in the header with the specified <i>orientation</i> to the <i>value</i> supplied.</p>
314
 
<p>Returns true if the header's data was updated; otherwise returns false.</p>
315
 
<p>When reimplementing this function, the <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>() signal must be emitted explicitly.</p>
 
885
 
 
886
 
 
887
<h3 class="fn"><a name="setHeaderData" />bool QAbstractItemModel.setHeaderData (<i>self</i>, int, <a href="qt.html#Orientation-enum">Qt.Orientation</a>, QVariant, int&#160;<i>role</i>&#160;=&#160;Qt.EditRole)</h3><p>Sets the data for the given <i>role</i> and <i>section</i> in
 
888
the header with the specified <i>orientation</i> to the
 
889
<i>value</i> supplied.</p>
 
890
<p>Returns true if the header's data was updated; otherwise returns
 
891
false.</p>
 
892
<p>When reimplementing this function, the <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>()
 
893
signal must be emitted explicitly.</p>
316
894
<p>See also <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a> and <a href="qabstractitemmodel.html#headerData">headerData</a>().</p>
317
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/setItemData" />
318
 
<h3 class="fn"><a name="setItemData" />bool QAbstractItemModel.setItemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, dict-of-int-QVariant)</h3><p>Sets the role data for the item at <i>index</i> to the associated value in <i>roles</i>, for every <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>.</p>
 
895
 
 
896
 
 
897
<h3 class="fn"><a name="setItemData" />bool QAbstractItemModel.setItemData (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>, dict-of-int-QVariant)</h3><p>Sets the role data for the item at <i>index</i> to the
 
898
associated value in <i>roles</i>, for every <a href="qt.html#ItemDataRole-enum">Qt.ItemDataRole</a>.</p>
319
899
<p>Returns true if successful; otherwise returns false.</p>
320
900
<p>Roles that are not in <i>roles</i> will not be modified.</p>
321
901
<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>
322
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/setRoleNames" />
 
902
 
 
903
 
323
904
<h3 class="fn"><a name="setRoleNames" />QAbstractItemModel.setRoleNames (<i>self</i>, dict-of-int-QByteArray)</h3><p>Sets the model's role names to <i>roleNames</i>.</p>
324
 
<p>This function allows mapping of role identifiers to role property names in Declarative UI. This function must be called before the model is used. Modifying the role names after the model has been set may result in undefined behaviour.</p>
 
905
<p>This function allows mapping of role identifiers to role
 
906
property names in Declarative UI. This function must be called
 
907
before the model is used. Modifying the role names after the model
 
908
has been set may result in undefined behaviour.</p>
325
909
<p>This function was introduced in Qt 4.6.</p>
326
910
<p>See also <a href="qabstractitemmodel.html#roleNames">roleNames</a>().</p>
327
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/setSupportedDragActions" />
328
 
<h3 class="fn"><a name="setSupportedDragActions" />QAbstractItemModel.setSupportedDragActions (<i>self</i>, <a href="qt-dropactions.html">Qt.DropActions</a>)</h3><p>Sets the supported drag <i>actions</i> for the items in the model.</p>
 
911
 
 
912
 
 
913
<h3 class="fn"><a name="setSupportedDragActions" />QAbstractItemModel.setSupportedDragActions (<i>self</i>, <a href="qt-dropactions.html">Qt.DropActions</a>)</h3><p>Sets the supported drag <i>actions</i> for the items in the
 
914
model.</p>
329
915
<p>This function was introduced in Qt 4.2.</p>
330
 
<p>See also <a href="qabstractitemmodel.html#supportedDragActions">supportedDragActions</a>() and <a href="model-view-dnd.html">Using Drag and Drop with Item Views</a>.</p>
331
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/sibling" />
332
 
<h3 class="fn"><a name="sibling" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.sibling (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>)</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>
333
 
<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>
334
 
<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>
335
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/sort" />
 
916
<p>See also <a href="qabstractitemmodel.html#supportedDragActions">supportedDragActions</a>()
 
917
and Using Drag and Drop with Item Views.</p>
 
918
 
 
919
 
 
920
<h3 class="fn"><a name="sibling" /><a href="qmodelindex.html">QModelIndex</a> QAbstractItemModel.sibling (<i>self</i>, int, int, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Returns the sibling at <i>row</i> and <i>column</i> for the item
 
921
at <i>index</i>, or an invalid <a href="qmodelindex.html">QModelIndex</a> if there is no sibling at that
 
922
location.</p>
 
923
<p>sibling() is just a convenience function that finds the item's
 
924
parent, and uses it to retrieve the index of the child item in the
 
925
specified <i>row</i> and <i>column</i>.</p>
 
926
<p>See also <a href="qabstractitemmodel.html#index">index</a>(),
 
927
<a href="qmodelindex.html#row">QModelIndex.row</a>(), and <a href="qmodelindex.html#column">QModelIndex.column</a>().</p>
 
928
 
 
929
 
336
930
<h3 class="fn"><a name="sort" />QAbstractItemModel.sort (<i>self</i>, int, <a href="qt.html#SortOrder-enum">Qt.SortOrder</a>&#160;<i>order</i>&#160;=&#160;Qt.AscendingOrder)</h3><p>Sorts the model by <i>column</i> in the given <i>order</i>.</p>
337
931
<p>The base class implementation does nothing.</p>
338
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/span" />
339
 
<h3 class="fn"><a name="span" /><a href="qsize.html">QSize</a> QAbstractItemModel.span (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Returns the row and column span of the item represented by <i>index</i>.</p>
 
932
 
 
933
 
 
934
<h3 class="fn"><a name="span" /><a href="qsize.html">QSize</a> QAbstractItemModel.span (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>)</h3><p>Returns the row and column span of the item represented by
 
935
<i>index</i>.</p>
340
936
<p><b>Note:</b> Currently, span is not used.</p>
341
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/submit" />
342
 
<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>Lets the model know that it should submit cached information to permanent storage. This function is typically used for row editing.</p>
 
937
 
 
938
 
 
939
<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>Lets the model know that it should submit cached information to
 
940
permanent storage. This function is typically used for row
 
941
editing.</p>
343
942
<p>Returns true if there is no error; otherwise returns false.</p>
344
943
<p>See also <a href="qabstractitemmodel.html#revert">revert</a>().</p>
345
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/supportedDragActions" />
 
944
 
 
945
 
346
946
<h3 class="fn"><a name="supportedDragActions" /><a href="qt-dropactions.html">Qt.DropActions</a> QAbstractItemModel.supportedDragActions (<i>self</i>)</h3><p>Returns the actions supported by the data in this model.</p>
347
 
<p>The default implementation returns <a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a>() unless specific values have been set with <a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a>().</p>
348
 
<p>supportedDragActions() is used by <a href="qabstractitemview.html#startDrag">QAbstractItemView.startDrag</a>() as the default values when a drag occurs.</p>
349
 
<p>See also <a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a>(), <a href="qt.html#DropAction-enum">Qt.DropActions</a>, and <a href="model-view-dnd.html">Using Drag and Drop with Item Views</a>.</p>
350
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/supportedDropActions" />
 
947
<p>The default implementation returns <a href="qabstractitemmodel.html#supportedDropActions">supportedDropActions</a>()
 
948
unless specific values have been set with <a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a>().</p>
 
949
<p>supportedDragActions() is used by <a href="qabstractitemview.html#startDrag">QAbstractItemView.startDrag</a>()
 
950
as the default values when a drag occurs.</p>
 
951
<p>See also <a href="qabstractitemmodel.html#setSupportedDragActions">setSupportedDragActions</a>(),
 
952
<a href="qt.html#DropAction-enum">Qt.DropActions</a>, and Using
 
953
Drag and Drop with Item Views.</p>
 
954
 
 
955
 
351
956
<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>
352
 
<p>The default implementation returns <a href="qt.html#DropAction-enum">Qt.CopyAction</a>. Reimplement this function if you wish to support additional actions. You must also reimplement the <a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a>() function to handle the additional operations.</p>
353
 
<p>This function was introduced in Qt 4.2.</p>
354
 
<p>See also <a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a>(), <a href="qt.html#DropAction-enum">Qt.DropActions</a>, and <a href="model-view-dnd.html">Using Drag and Drop with Item Views</a>.</p>
355
 
<p /><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="columnsAboutToBeInserted" />void columnsAboutToBeInserted (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are inserted into the model. The new items will be positioned between <i>start</i> and <i>end</i> inclusive, under the given <i>parent</i> item.</p>
356
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
357
 
<p>See also <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() and <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
358
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/columnsAboutToBeMoved" />
359
 
<h3 class="fn"><a name="columnsAboutToBeMoved" />void columnsAboutToBeMoved (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are moved within the model. The items that will be moved are those between <i>sourceStart</i> and <i>sourceEnd</i> inclusive, under the given <i>sourceParent</i> item. They will be moved to <i>destinationParent</i> starting at the column <i>destinationColumn</i>.</p>
360
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
361
 
<p>This function was introduced in Qt 4.6.</p>
362
 
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
363
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/columnsAboutToBeRemoved" />
364
 
<h3 class="fn"><a name="columnsAboutToBeRemoved" />void columnsAboutToBeRemoved (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are removed from the model. The items to be removed are those between <i>start</i> and <i>end</i> inclusive, under the given <i>parent</i> item.</p>
365
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
366
 
<p>See also <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() and <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
367
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/columnsInserted" />
368
 
<h3 class="fn"><a name="columnsInserted" />void columnsInserted (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been inserted into the model. The new items are those between <i>start</i> and <i>end</i> inclusive, under the given <i>parent</i> item.</p>
369
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
370
 
<p>See also <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() and <a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
371
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/columnsMoved" />
372
 
<h3 class="fn"><a name="columnsMoved" />void columnsMoved (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been moved within the model. The items between <i>sourceStart</i> and <i>sourceEnd</i> inclusive, under the given <i>sourceParent</i> item have been moved to <i>destinationParent</i> starting at the column <i>destinationColumn</i>.</p>
373
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
374
 
<p>This function was introduced in Qt 4.6.</p>
375
 
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
376
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/columnsRemoved" />
377
 
<h3 class="fn"><a name="columnsRemoved" />void columnsRemoved (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been removed from the model. The removed items are those between <i>start</i> and <i>end</i> inclusive, under the given <i>parent</i> item.</p>
378
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
379
 
<p>See also <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() and <a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
380
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/createIndex" />
381
 
<h3 class="fn"><a name="dataChanged" />void dataChanged (const QModelIndex&amp;,const QModelIndex&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the data in an existing item changes.</p>
382
 
<p>If the items are of the same parent, the affected ones are those between <i>topLeft</i> and <i>bottomRight</i> inclusive. If the items do not have the same parent, the behavior is undefined.</p>
383
 
<p>When reimplementing the <a href="qabstractitemmodel.html#setData">setData</a>() function, this signal must be emitted explicitly.</p>
384
 
<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>
385
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/dropMimeData" />
386
 
<h3 class="fn"><a name="headerDataChanged" />void headerDataChanged (Qt::Orientation,int,int)</h3><p>This is the default overload of this signal.</p><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>
387
 
<p>When reimplementing the <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>() function, this signal must be emitted explicitly.</p>
388
 
<p>If you are changing the number of columns or rows you do not need to emit this signal, but use the begin/end functions (refer to the section on subclassing in the <a href="qabstractitemmodel.html">QAbstractItemModel</a> class description for details).</p>
389
 
<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>
390
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/index" />
391
 
<h3 class="fn"><a name="layoutAboutToBeChanged" />void layoutAboutToBeChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before the layout of a model is changed. Components connected to this signal use it to adapt to changes in the model's layout.</p>
392
 
<p>Subclasses should update any persistent model indexes after emitting layoutAboutToBeChanged().</p>
393
 
<p>This function was introduced in Qt 4.2.</p>
394
 
<p>See also <a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>() and <a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
395
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/layoutChanged" />
396
 
<h3 class="fn"><a name="layoutChanged" />void layoutChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the layout of items exposed by the model has changed; for example, when the model has been sorted. When this signal is received by a view, it should update the layout of items to reflect this change.</p>
397
 
<p>When subclassing <a href="qabstractitemmodel.html">QAbstractItemModel</a> or <a href="qabstractproxymodel.html">QAbstractProxyModel</a>, ensure that you emit <a href="qabstractitemmodel.html#layoutAboutToBeChanged">layoutAboutToBeChanged</a>() before changing the order of items or altering the structure of the data you expose to views, and emit layoutChanged() after changing the layout.</p>
398
 
<p>Subclasses should update any persistent model indexes before emitting layoutChanged(). In other words, when the structure changes:</p>
 
957
<p>The default implementation returns <a href="qt.html#DropAction-enum">Qt.CopyAction</a>. Reimplement this
 
958
function if you wish to support additional actions. You must also
 
959
reimplement the <a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a>() function
 
960
to handle the additional operations.</p>
 
961
<p>This function was introduced in Qt 4.2.</p>
 
962
<p>See also <a href="qabstractitemmodel.html#dropMimeData">dropMimeData</a>(), <a href="qt.html#DropAction-enum">Qt.DropActions</a>, and Using Drag and
 
963
Drop with Item Views.</p>
 
964
<hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="columnsAboutToBeInserted" />void columnsAboutToBeInserted (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are inserted into the
 
965
model. The new items will be positioned between <i>start</i> and
 
966
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
 
967
<p><b>Note:</b> Components connected to this signal use it to adapt
 
968
to changes in the model's dimensions. It can only be emitted by the
 
969
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
970
implementation, and cannot be explicitly emitted in subclass
 
971
code.</p>
 
972
<p>See also <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() and
 
973
<a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
 
974
 
 
975
 
 
976
<h3 class="fn"><a name="columnsAboutToBeMoved" />void columnsAboutToBeMoved (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are moved within the
 
977
model. The items that will be moved are those between
 
978
<i>sourceStart</i> and <i>sourceEnd</i> inclusive, under the given
 
979
<i>sourceParent</i> item. They will be moved to
 
980
<i>destinationParent</i> starting at the column
 
981
<i>destinationColumn</i>.</p>
 
982
<p><b>Note:</b> Components connected to this signal use it to adapt
 
983
to changes in the model's dimensions. It can only be emitted by the
 
984
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
985
implementation, and cannot be explicitly emitted in subclass
 
986
code.</p>
 
987
<p>This function was introduced in Qt 4.6.</p>
 
988
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
 
989
 
 
990
 
 
991
<h3 class="fn"><a name="columnsAboutToBeRemoved" />void columnsAboutToBeRemoved (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before columns are removed from the
 
992
model. The items to be removed are those between <i>start</i> and
 
993
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
 
994
<p><b>Note:</b> Components connected to this signal use it to adapt
 
995
to changes in the model's dimensions. It can only be emitted by the
 
996
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
997
implementation, and cannot be explicitly emitted in subclass
 
998
code.</p>
 
999
<p>See also <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() and
 
1000
<a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
 
1001
 
 
1002
 
 
1003
<h3 class="fn"><a name="columnsInserted" />void columnsInserted (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been inserted into the
 
1004
model. The new items are those between <i>start</i> and <i>end</i>
 
1005
inclusive, under the given <i>parent</i> item.</p>
 
1006
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1007
to changes in the model's dimensions. It can only be emitted by the
 
1008
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1009
implementation, and cannot be explicitly emitted in subclass
 
1010
code.</p>
 
1011
<p>See also <a href="qabstractitemmodel.html#insertColumns">insertColumns</a>() and
 
1012
<a href="qabstractitemmodel.html#beginInsertColumns">beginInsertColumns</a>().</p>
 
1013
 
 
1014
 
 
1015
<h3 class="fn"><a name="columnsMoved" />void columnsMoved (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been moved within the
 
1016
model. The items between <i>sourceStart</i> and <i>sourceEnd</i>
 
1017
inclusive, under the given <i>sourceParent</i> item have been moved
 
1018
to <i>destinationParent</i> starting at the column
 
1019
<i>destinationColumn</i>.</p>
 
1020
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1021
to changes in the model's dimensions. It can only be emitted by the
 
1022
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1023
implementation, and cannot be explicitly emitted in subclass
 
1024
code.</p>
 
1025
<p>This function was introduced in Qt 4.6.</p>
 
1026
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
 
1027
 
 
1028
 
 
1029
<h3 class="fn"><a name="columnsRemoved" />void columnsRemoved (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after columns have been removed from the
 
1030
model. The removed items are those between <i>start</i> and
 
1031
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
 
1032
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1033
to changes in the model's dimensions. It can only be emitted by the
 
1034
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1035
implementation, and cannot be explicitly emitted in subclass
 
1036
code.</p>
 
1037
<p>See also <a href="qabstractitemmodel.html#removeColumns">removeColumns</a>() and
 
1038
<a href="qabstractitemmodel.html#beginRemoveColumns">beginRemoveColumns</a>().</p>
 
1039
 
 
1040
 
 
1041
<h3 class="fn"><a name="dataChanged" />void dataChanged (const QModelIndex&amp;,const QModelIndex&amp;)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the data in an existing item
 
1042
changes.</p>
 
1043
<p>If the items are of the same parent, the affected ones are those
 
1044
between <i>topLeft</i> and <i>bottomRight</i> inclusive. If the
 
1045
items do not have the same parent, the behavior is undefined.</p>
 
1046
<p>When reimplementing the <a href="qabstractitemmodel.html#setData">setData</a>() function, this
 
1047
signal must be emitted explicitly.</p>
 
1048
<p>See also <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>(),
 
1049
<a href="qabstractitemmodel.html#setData">setData</a>(), and
 
1050
<a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>().</p>
 
1051
 
 
1052
 
 
1053
<h3 class="fn"><a name="headerDataChanged" />void headerDataChanged (Qt::Orientation,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever a header is changed. The
 
1054
<i>orientation</i> indicates whether the horizontal or vertical
 
1055
header has changed. The sections in the header from the
 
1056
<i>first</i> to the <i>last</i> need to be updated.</p>
 
1057
<p>When reimplementing the <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>()
 
1058
function, this signal must be emitted explicitly.</p>
 
1059
<p>If you are changing the number of columns or rows you do not
 
1060
need to emit this signal, but use the begin/end functions (refer to
 
1061
the section on subclassing in the <a href="qabstractitemmodel.html">QAbstractItemModel</a> class description
 
1062
for details).</p>
 
1063
<p>See also <a href="qabstractitemmodel.html#headerData">headerData</a>(), <a href="qabstractitemmodel.html#setHeaderData">setHeaderData</a>(), and
 
1064
<a href="qabstractitemmodel.html#dataChanged">dataChanged</a>().</p>
 
1065
 
 
1066
 
 
1067
<h3 class="fn"><a name="layoutAboutToBeChanged" />void layoutAboutToBeChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before the layout of a model is
 
1068
changed. Components connected to this signal use it to adapt to
 
1069
changes in the model's layout.</p>
 
1070
<p>Subclasses should update any persistent model indexes after
 
1071
emitting layoutAboutToBeChanged().</p>
 
1072
<p>This function was introduced in Qt 4.2.</p>
 
1073
<p>See also <a href="qabstractitemmodel.html#layoutChanged">layoutChanged</a>() and
 
1074
<a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
 
1075
 
 
1076
 
 
1077
<h3 class="fn"><a name="layoutChanged" />void layoutChanged ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted whenever the layout of items exposed by
 
1078
the model has changed; for example, when the model has been sorted.
 
1079
When this signal is received by a view, it should update the layout
 
1080
of items to reflect this change.</p>
 
1081
<p>When subclassing <a href="qabstractitemmodel.html">QAbstractItemModel</a> or <a href="qabstractproxymodel.html">QAbstractProxyModel</a>, ensure that you
 
1082
emit <a href="qabstractitemmodel.html#layoutAboutToBeChanged">layoutAboutToBeChanged</a>()
 
1083
before changing the order of items or altering the structure of the
 
1084
data you expose to views, and emit layoutChanged() after changing
 
1085
the layout.</p>
 
1086
<p>Subclasses should update any persistent model indexes before
 
1087
emitting layoutChanged(). In other words, when the structure
 
1088
changes:</p>
399
1089
<ul>
400
1090
<li>Call beginLayoutChanged()</li>
401
 
<li>Remember the <a href="qmodelindex.html">QModelIndex</a> that will change</li>
 
1091
<li>Remember the <a href="qmodelindex.html">QModelIndex</a> that
 
1092
will change</li>
402
1093
<li>Update your internal data</li>
403
1094
<li>Call <a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>()</li>
404
1095
<li>Call endLayoutChanged()</li>
405
1096
</ul>
406
 
<p>See also <a href="qabstractitemmodel.html#layoutAboutToBeChanged">layoutAboutToBeChanged</a>(), <a href="qabstractitemmodel.html#dataChanged">dataChanged</a>(), <a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>(), <a href="qabstractitemmodel.html#modelReset">modelReset</a>(), and <a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
407
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/match" />
408
 
<h3 class="fn"><a name="modelAboutToBeReset" />void modelAboutToBeReset ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when <a href="qabstractitemmodel.html#reset">reset</a>() is called, before the model's internal state (e.g. persistent model indexes) has been invalidated.</p>
 
1097
<p>See also <a href="qabstractitemmodel.html#layoutAboutToBeChanged">layoutAboutToBeChanged</a>(),
 
1098
<a href="qabstractitemmodel.html#dataChanged">dataChanged</a>(),
 
1099
<a href="qabstractitemmodel.html#headerDataChanged">headerDataChanged</a>(),
 
1100
<a href="qabstractitemmodel.html#modelReset">modelReset</a>(), and
 
1101
<a href="qabstractitemmodel.html#changePersistentIndex">changePersistentIndex</a>().</p>
 
1102
 
 
1103
 
 
1104
<h3 class="fn"><a name="modelAboutToBeReset" />void modelAboutToBeReset ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when <a href="qabstractitemmodel.html#reset">reset</a>() is called, before the
 
1105
model's internal state (e.g. persistent model indexes) has been
 
1106
invalidated.</p>
409
1107
<p>This function was introduced in Qt 4.2.</p>
410
 
<p>See also <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() and <a href="qabstractitemmodel.html#modelReset">modelReset</a>().</p>
411
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/modelReset" />
412
 
<h3 class="fn"><a name="modelReset" />void modelReset ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when <a href="qabstractitemmodel.html#reset">reset</a>() is called, after the model's internal state (e.g. persistent model indexes) has been invalidated.</p>
 
1108
<p>See also <a href="qabstractitemmodel.html#beginResetModel">beginResetModel</a>() and
 
1109
<a href="qabstractitemmodel.html#modelReset">modelReset</a>().</p>
 
1110
 
 
1111
 
 
1112
<h3 class="fn"><a name="modelReset" />void modelReset ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted when <a href="qabstractitemmodel.html#reset">reset</a>() is called, after the
 
1113
model's internal state (e.g. persistent model indexes) has been
 
1114
invalidated.</p>
413
1115
<p>This function was introduced in Qt 4.1.</p>
414
 
<p>See also <a href="qabstractitemmodel.html#endResetModel">endResetModel</a>() and <a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>().</p>
415
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/parent" />
416
 
<h3 class="fn"><a name="rowsAboutToBeInserted" />void rowsAboutToBeInserted (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are inserted into the model. The new items will be positioned between <i>start</i> and <i>end</i> inclusive, under the given <i>parent</i> item.</p>
417
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
418
 
<p>See also <a href="qabstractitemmodel.html#insertRows">insertRows</a>() and <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
419
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/rowsAboutToBeMoved" />
420
 
<h3 class="fn"><a name="rowsAboutToBeMoved" />void rowsAboutToBeMoved (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are moved within the model. The items that will be moved are those between <i>sourceStart</i> and <i>sourceEnd</i> inclusive, under the given <i>sourceParent</i> item. They will be moved to <i>destinationParent</i> starting at the row <i>destinationRow</i>.</p>
421
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
422
 
<p>This function was introduced in Qt 4.6.</p>
423
 
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
424
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/rowsAboutToBeRemoved" />
425
 
<h3 class="fn"><a name="rowsAboutToBeRemoved" />void rowsAboutToBeRemoved (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are removed from the model. The items that will be removed are those between <i>start</i> and <i>end</i> inclusive, under the given <i>parent</i> item.</p>
426
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
427
 
<p>See also <a href="qabstractitemmodel.html#removeRows">removeRows</a>() and <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
428
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/rowsInserted" />
429
 
<h3 class="fn"><a name="rowsInserted" />void rowsInserted (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been inserted into the model. The new items are those between <i>start</i> and <i>end</i> inclusive, under the given <i>parent</i> item.</p>
430
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
431
 
<p>See also <a href="qabstractitemmodel.html#insertRows">insertRows</a>() and <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
432
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/rowsMoved" />
433
 
<h3 class="fn"><a name="rowsMoved" />void rowsMoved (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been moved within the model. The items between <i>sourceStart</i> and <i>sourceEnd</i> inclusive, under the given <i>sourceParent</i> item have been moved to <i>destinationParent</i> starting at the row <i>destinationRow</i>.</p>
434
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
435
 
<p>This function was introduced in Qt 4.6.</p>
436
 
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
437
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/rowsRemoved" />
438
 
<h3 class="fn"><a name="rowsRemoved" />void rowsRemoved (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been removed from the model. The removed items are those between <i>start</i> and <i>end</i> inclusive, under the given <i>parent</i> item.</p>
439
 
<p><b>Note:</b> Components connected to this signal use it to adapt to changes in the model's dimensions. It can only be emitted by the <a href="qabstractitemmodel.html">QAbstractItemModel</a> implementation, and cannot be explicitly emitted in subclass code.</p>
440
 
<p>See also <a href="qabstractitemmodel.html#removeRows">removeRows</a>() and <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
441
 
<a name="//apple_ref/cpp/instm/QAbstractItemModel/setData" />
442
 
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.7 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.3</td></tr></table></div></address></body></html>
 
 
b'\\ No newline at end of file'
 
1116
<p>See also <a href="qabstractitemmodel.html#endResetModel">endResetModel</a>() and
 
1117
<a href="qabstractitemmodel.html#modelAboutToBeReset">modelAboutToBeReset</a>().</p>
 
1118
 
 
1119
 
 
1120
<h3 class="fn"><a name="rowsAboutToBeInserted" />void rowsAboutToBeInserted (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are inserted into the
 
1121
model. The new items will be positioned between <i>start</i> and
 
1122
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
 
1123
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1124
to changes in the model's dimensions. It can only be emitted by the
 
1125
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1126
implementation, and cannot be explicitly emitted in subclass
 
1127
code.</p>
 
1128
<p>See also <a href="qabstractitemmodel.html#insertRows">insertRows</a>() and <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
 
1129
 
 
1130
 
 
1131
<h3 class="fn"><a name="rowsAboutToBeMoved" />void rowsAboutToBeMoved (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are moved within the
 
1132
model. The items that will be moved are those between
 
1133
<i>sourceStart</i> and <i>sourceEnd</i> inclusive, under the given
 
1134
<i>sourceParent</i> item. They will be moved to
 
1135
<i>destinationParent</i> starting at the row
 
1136
<i>destinationRow</i>.</p>
 
1137
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1138
to changes in the model's dimensions. It can only be emitted by the
 
1139
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1140
implementation, and cannot be explicitly emitted in subclass
 
1141
code.</p>
 
1142
<p>This function was introduced in Qt 4.6.</p>
 
1143
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
 
1144
 
 
1145
 
 
1146
<h3 class="fn"><a name="rowsAboutToBeRemoved" />void rowsAboutToBeRemoved (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted just before rows are removed from the
 
1147
model. The items that will be removed are those between
 
1148
<i>start</i> and <i>end</i> inclusive, under the given
 
1149
<i>parent</i> item.</p>
 
1150
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1151
to changes in the model's dimensions. It can only be emitted by the
 
1152
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1153
implementation, and cannot be explicitly emitted in subclass
 
1154
code.</p>
 
1155
<p>See also <a href="qabstractitemmodel.html#removeRows">removeRows</a>() and <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
 
1156
 
 
1157
 
 
1158
<h3 class="fn"><a name="rowsInserted" />void rowsInserted (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been inserted into the
 
1159
model. The new items are those between <i>start</i> and <i>end</i>
 
1160
inclusive, under the given <i>parent</i> item.</p>
 
1161
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1162
to changes in the model's dimensions. It can only be emitted by the
 
1163
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1164
implementation, and cannot be explicitly emitted in subclass
 
1165
code.</p>
 
1166
<p>See also <a href="qabstractitemmodel.html#insertRows">insertRows</a>() and <a href="qabstractitemmodel.html#beginInsertRows">beginInsertRows</a>().</p>
 
1167
 
 
1168
 
 
1169
<h3 class="fn"><a name="rowsMoved" />void rowsMoved (const QModelIndex&amp;,int,int,const QModelIndex&amp;,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been moved within the
 
1170
model. The items between <i>sourceStart</i> and <i>sourceEnd</i>
 
1171
inclusive, under the given <i>sourceParent</i> item have been moved
 
1172
to <i>destinationParent</i> starting at the row
 
1173
<i>destinationRow</i>.</p>
 
1174
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1175
to changes in the model's dimensions. It can only be emitted by the
 
1176
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1177
implementation, and cannot be explicitly emitted in subclass
 
1178
code.</p>
 
1179
<p>This function was introduced in Qt 4.6.</p>
 
1180
<p>See also <a href="qabstractitemmodel.html#beginMoveRows">beginMoveRows</a>().</p>
 
1181
 
 
1182
 
 
1183
<h3 class="fn"><a name="rowsRemoved" />void rowsRemoved (const QModelIndex&amp;,int,int)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted after rows have been removed from the
 
1184
model. The removed items are those between <i>start</i> and
 
1185
<i>end</i> inclusive, under the given <i>parent</i> item.</p>
 
1186
<p><b>Note:</b> Components connected to this signal use it to adapt
 
1187
to changes in the model's dimensions. It can only be emitted by the
 
1188
<a href="qabstractitemmodel.html">QAbstractItemModel</a>
 
1189
implementation, and cannot be explicitly emitted in subclass
 
1190
code.</p>
 
1191
<p>See also <a href="qabstractitemmodel.html#removeRows">removeRows</a>() and <a href="qabstractitemmodel.html#beginRemoveRows">beginRemoveRows</a>().</p>
 
1192
 
 
1193
 
 
1194
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.8.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.7.0</td></tr></table></div></address></body></html>
 
 
b'\\ No newline at end of file'