File: qmodelindex.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (37 lines) | stat: -rw-r--r-- 10,292 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QModelIndex Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#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">QModelIndex Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QModelIndex class is used to locate data in a data model. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qmodelindex.html#QModelIndex">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmodelindex.html#QModelIndex-2">__init__</a></b> (<i>self</i>, QModelIndex&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qmodelindex.html#QModelIndex-3">__init__</a></b> (<i>self</i>, QPersistentModelIndex)</li><li><div class="fn" />QModelIndex <b><a href="qmodelindex.html#child">child</a></b> (<i>self</i>, int&#160;<i>arow</i>, int&#160;<i>acolumn</i>)</li><li><div class="fn" />int <b><a href="qmodelindex.html#column">column</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qmodelindex.html#data">data</a></b> (<i>self</i>, int&#160;<i>arole</i>&#160;=&#160;Qt.DisplayRole)</li><li><div class="fn" />long <b><a href="qmodelindex.html#internalId">internalId</a></b> (<i>self</i>)</li><li><div class="fn" />object <b><a href="qmodelindex.html#internalPointer">internalPointer</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmodelindex.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />QAbstractItemModel <b><a href="qmodelindex.html#model">model</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qmodelindex.html#parent">parent</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qmodelindex.html#row">row</a></b> (<i>self</i>)</li><li><div class="fn" />QModelIndex <b><a href="qmodelindex.html#sibling">sibling</a></b> (<i>self</i>, int&#160;<i>arow</i>, int&#160;<i>acolumn</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qmodelindex.html#__eq__">__eq__</a></b> (<i>self</i>, QModelIndex&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qmodelindex.html#__lt__">__lt__</a></b> (<i>self</i>, QModelIndex&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qmodelindex.html#__ne__">__ne__</a></b> (<i>self</i>, QModelIndex&#160;<i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QModelIndex class is used to locate data in a data model.</p>
<p>This class is used as an index into item models derived from <a href="qabstractitemmodel.html">QAbstractItemModel</a>. The index is used by item views, delegates, and selection models to locate an item in the model.</p>
<p>New QModelIndex objects are created by the model using the <a href="qabstractitemmodel.html#createIndex">QAbstractItemModel.createIndex</a>() function. An <i>invalid</i> model index can be constructed with the QModelIndex constructor. Invalid indexes are often used as parent indexes when referring to top-level items in a model.</p>
<p>Model indexes refer to items in models, and contain all the information required to specify their locations in those models. Each index is located in a given row and column, and may have a parent index; use <a href="qmodelindex.html#row">row</a>(), <a href="qmodelindex.html#column">column</a>(), and <a href="qmodelindex.html#parent">parent</a>() to obtain this information. Each top-level item in a model is represented by a model index that does not have a parent index - in this case, <a href="qmodelindex.html#parent">parent</a>() will return an invalid model index, equivalent to an index constructed with the zero argument form of the <a href="qmodelindex.html#QModelIndex">QModelIndex</a>() constructor.</p>
<p>To obtain a model index that refers to an existing item in a model, call <a href="qabstractitemmodel.html#index">QAbstractItemModel.index</a>() with the required row and column values, and the model index of the parent. When referring to top-level items in a model, supply <a href="qmodelindex.html#QModelIndex">QModelIndex</a>() as the parent index.</p>
<p>The <a href="qmodelindex.html#model">model</a>() function returns the model that the index references as a <a href="qabstractitemmodel.html">QAbstractItemModel</a>. The <a href="qmodelindex.html#child">child</a>() function is used to examine the items held beneath the index in the model. The <a href="qmodelindex.html#sibling">sibling</a>() function allows you to traverse items in the model on the same level as the index.</p>
<p>Model indexes can become invalid over time so they should be used immediately and then discarded. If you need to keep a model index over time use a <a href="qpersistentmodelindex.html">QPersistentModelIndex</a>.</p>
<p>See also <a href="model-view-programming.html">Model/View Programming</a>, <a href="qpersistentmodelindex.html">QPersistentModelIndex</a>, and <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QModelIndex" />QModelIndex.__init__ (<i>self</i>)</h3><p>Creates a new empty model index. This type of model index is used to indicate that the position in the model is invalid.</p>
<p>See also <a href="qmodelindex.html#isValid">isValid</a>() and <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p>
<h3 class="fn"><a name="QModelIndex-2" />QModelIndex.__init__ (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>other</i>)</h3><p>Creates a new model index that is a copy of the <i>other</i> model index.</p>
<h3 class="fn"><a name="QModelIndex-3" />QModelIndex.__init__ (<i>self</i>, <a href="qpersistentmodelindex.html">QPersistentModelIndex</a>)</h3><h3 class="fn"><a name="child" /><a href="qmodelindex.html">QModelIndex</a> QModelIndex.child (<i>self</i>, int&#160;<i>arow</i>, int&#160;<i>acolumn</i>)</h3><p>Returns the child of the model index that is stored in the given <i>row</i> and <i>column</i>.</p>
<p>See also <a href="qmodelindex.html#parent">parent</a>() and <a href="qmodelindex.html#sibling">sibling</a>().</p>
<h3 class="fn"><a name="column" />int QModelIndex.column (<i>self</i>)</h3><p>Returns the column this model index refers to.</p>
<h3 class="fn"><a name="data" /><a href="qvariant.html">QVariant</a> QModelIndex.data (<i>self</i>, int&#160;<i>arole</i>&#160;=&#160;Qt.DisplayRole)</h3><p>Returns the data for the given <i>role</i> for the item referred to by the index.</p>
<h3 class="fn"><a name="internalId" />long QModelIndex.internalId (<i>self</i>)</h3><p>Returns a <tt>long</tt> used by the model to associate the index with the internal data structure.</p>
<p>See also <a href="qabstractitemmodel.html#createIndex">QAbstractItemModel.createIndex</a>().</p>
<h3 class="fn"><a name="internalPointer" />object QModelIndex.internalPointer (<i>self</i>)</h3><p>Returns a <tt>void</tt> <tt>*</tt> pointer used by the model to associate the index with the internal data structure.</p>
<p>See also <a href="qabstractitemmodel.html#createIndex">QAbstractItemModel.createIndex</a>().</p>
<h3 class="fn"><a name="isValid" />bool QModelIndex.isValid (<i>self</i>)</h3><p>Returns true if this model index is valid; otherwise returns false. A valid index belongs to a model, and has non-negative row and column numbers.</p>
<p>See also <a href="qmodelindex.html#model">model</a>(), <a href="qmodelindex.html#row">row</a>(), and <a href="qmodelindex.html#column">column</a>().</p>
<h3 class="fn"><a name="model" /><a href="qabstractitemmodel.html">QAbstractItemModel</a> QModelIndex.model (<i>self</i>)</h3><p>Returns a pointer to the model containing the item that this index refers to.</p>
<h3 class="fn"><a name="parent" /><a href="qmodelindex.html">QModelIndex</a> QModelIndex.parent (<i>self</i>)</h3><p>Return the parent of the model index, or <a href="qmodelindex.html#QModelIndex">QModelIndex</a>() if it has no parent.</p>
<p>See also <a href="qmodelindex.html#child">child</a>(), <a href="qmodelindex.html#sibling">sibling</a>(), and <a href="qmodelindex.html#model">model</a>().</p>
<h3 class="fn"><a name="row" />int QModelIndex.row (<i>self</i>)</h3><p>Returns the row this model index refers to.</p>
<h3 class="fn"><a name="sibling" /><a href="qmodelindex.html">QModelIndex</a> QModelIndex.sibling (<i>self</i>, int&#160;<i>arow</i>, int&#160;<i>acolumn</i>)</h3><p>Returns the sibling at <i>row</i> and <i>column</i> or an invalid <a href="qmodelindex.html">QModelIndex</a> if there is no sibling at this position.</p>
<p>See also <a href="qmodelindex.html#parent">parent</a>() and <a href="qmodelindex.html#child">child</a>().</p>
<h3 class="fn"><a name="__eq__" />bool QModelIndex.__eq__ (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__lt__" />bool QModelIndex.__lt__ (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ne__" />bool QModelIndex.__ne__ (<i>self</i>, <a href="qmodelindex.html">QModelIndex</a>&#160;<i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.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.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>