~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qitemselectionmodel.html

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2006-10-12 23:14:14 UTC
  • mto: (15.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20061012231414-y2oqbom5dy389os0
Tags: upstream-4.2.0
ImportĀ upstreamĀ versionĀ 4.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<!DOCTYPE html
3
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
 
<!-- /tmp/qt-4.1.4-harald-1150713676011/qt-x11-opensource-src-4.1.4/src/gui/itemviews/qitemselectionmodel.cpp -->
6
 
<!-- /tmp/qt-4.1.4-harald-1150713676011/qt-x11-opensource-src-4.1.4/src/gui/itemviews/qitemselectionmodel.cpp -->
 
5
<!-- /tmp/qt-4.2.0-qt-1159540607313/qt-x11-opensource-src-4.2.0/src/gui/itemviews/qitemselectionmodel.cpp -->
7
6
<head>
8
 
    <title>Qt 4.1: QItemSelectionModel Class Reference</title>
9
 
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
10
 
a:link { color: #004faf; text-decoration: none }
11
 
a:visited { color: #672967; text-decoration: none }
12
 
td.postheader { font-family: sans-serif }
13
 
tr.address { font-family: sans-serif }
14
 
body { background: #ffffff; color: black; }</style>
 
7
  <title>Qt 4.2: QItemSelectionModel Class Reference</title>
 
8
  <link href="classic.css" rel="stylesheet" type="text/css" />
15
9
</head>
16
10
<body>
17
11
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
12
<tr>
19
 
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
13
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
20
14
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
21
 
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QItemSelectionModel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
 
15
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QItemSelectionModel Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
22
16
<p>The QItemSelectionModel class keeps track of a view's selected items. <a href="#details">More...</a></p>
23
 
<pre>#include &lt;QItemSelectionModel&gt;</pre><p>Inherits <a href="qobject.html">QObject</a>.</p>
 
17
<pre> #include &lt;QItemSelectionModel&gt;</pre><p>Inherits <a href="qobject.html">QObject</a>.</p>
24
18
<ul>
25
19
<li><a href="qitemselectionmodel-members.html">List of all members, including inherited members</a></li>
26
20
</ul>
38
32
<li><div class="fn"/>virtual <b><a href="qitemselectionmodel.html#dtor.QItemSelectionModel">~QItemSelectionModel</a></b> ()</li>
39
33
<li><div class="fn"/>bool <b><a href="qitemselectionmodel.html#columnIntersectsSelection">columnIntersectsSelection</a></b> ( int <i>column</i>, const QModelIndex &amp; <i>parent</i> ) const</li>
40
34
<li><div class="fn"/>QModelIndex <b><a href="qitemselectionmodel.html#currentIndex">currentIndex</a></b> () const</li>
 
35
<li><div class="fn"/>bool <b><a href="qitemselectionmodel.html#hasSelection">hasSelection</a></b> () const</li>
41
36
<li><div class="fn"/>bool <b><a href="qitemselectionmodel.html#isColumnSelected">isColumnSelected</a></b> ( int <i>column</i>, const QModelIndex &amp; <i>parent</i> ) const</li>
42
37
<li><div class="fn"/>bool <b><a href="qitemselectionmodel.html#isRowSelected">isRowSelected</a></b> ( int <i>row</i>, const QModelIndex &amp; <i>parent</i> ) const</li>
43
38
<li><div class="fn"/>bool <b><a href="qitemselectionmodel.html#isSelected">isSelected</a></b> ( const QModelIndex &amp; <i>index</i> ) const</li>
44
39
<li><div class="fn"/>const QAbstractItemModel * <b><a href="qitemselectionmodel.html#model">model</a></b> () const</li>
45
40
<li><div class="fn"/>bool <b><a href="qitemselectionmodel.html#rowIntersectsSelection">rowIntersectsSelection</a></b> ( int <i>row</i>, const QModelIndex &amp; <i>parent</i> ) const</li>
 
41
<li><div class="fn"/>QModelIndexList <b><a href="qitemselectionmodel.html#selectedColumns">selectedColumns</a></b> ( int <i>row</i> = 0 ) const</li>
46
42
<li><div class="fn"/>QModelIndexList <b><a href="qitemselectionmodel.html#selectedIndexes">selectedIndexes</a></b> () const</li>
 
43
<li><div class="fn"/>QModelIndexList <b><a href="qitemselectionmodel.html#selectedRows">selectedRows</a></b> ( int <i>column</i> = 0 ) const</li>
47
44
<li><div class="fn"/>const QItemSelection <b><a href="qitemselectionmodel.html#selection">selection</a></b> () const</li>
48
45
</ul>
49
46
<ul>
50
 
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
47
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
51
48
</ul>
52
49
<a name="public-slots"></a>
53
50
<h3>Public Slots</h3>
54
51
<ul>
55
52
<li><div class="fn"/>virtual void <b><a href="qitemselectionmodel.html#clear">clear</a></b> ()</li>
 
53
<li><div class="fn"/>void <b><a href="qitemselectionmodel.html#clearSelection">clearSelection</a></b> ()</li>
56
54
<li><div class="fn"/>virtual void <b><a href="qitemselectionmodel.html#reset">reset</a></b> ()</li>
57
55
<li><div class="fn"/>virtual void <b><a href="qitemselectionmodel.html#select">select</a></b> ( const QModelIndex &amp; <i>index</i>, QItemSelectionModel::SelectionFlags <i>command</i> )</li>
58
56
<li><div class="fn"/>virtual void <b><a href="qitemselectionmodel.html#select-2">select</a></b> ( const QItemSelection &amp; <i>selection</i>, QItemSelectionModel::SelectionFlags <i>command</i> )</li>
83
81
<h3>Additional Inherited Members</h3>
84
82
<ul>
85
83
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
86
 
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
84
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
87
85
</ul>
88
86
<a name="details"></a>
89
87
<hr />
94
92
<p>The selected items are stored using ranges. Whenever you want to modify the selected items use <a href="qitemselectionmodel.html#select">select</a>() and provide either a <a href="qitemselection.html">QItemSelection</a>, or a <a href="qmodelindex.html">QModelIndex</a> and a <a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::SelectionFlag</a>.</p>
95
93
<p>The QItemSelectionModel takes a two layer approach to selection management, dealing with both selected items that have been committed and items that are part of the current selection. The current selected items are part of the current interactive selection (for example with rubber-band selection or keyboard-shift selections).</p>
96
94
<p>To update the currently selected items, use the bitwise OR of <a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::Current</a> and any of the other <a href="qitemselectionmodel.html#SelectionFlag-enum">SelectionFlags</a>. If you omit the <a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::Current</a> command, a new current selection will be created, and the previous one added to the committed selection. All functions operate on both layers; for example, selectedItems() will return items from both layers.</p>
97
 
<p>See also <a href="model-view-programming.html">Model/View Programming</a> and <a href="qabstractitemmodel.html">QAbstractItemModel</a>.</p>
 
95
<p>See also <a href="model-view-programming.html">Model/View Programming</a>, <a href="qabstractitemmodel.html">QAbstractItemModel</a>, and <a href="itemviews-chart.html">Chart Example</a>.</p>
98
96
<hr />
99
97
<h2>Member Type Documentation</h2>
100
98
<h3 class="flags"><a name="SelectionFlag-enum"></a>enum QItemSelectionModel::SelectionFlag<br />flags QItemSelectionModel::SelectionFlags</h3>
124
122
<p>Destroys the selection model.</p>
125
123
<h3 class="fn"><a name="clear"></a>void QItemSelectionModel::clear ()&nbsp;&nbsp;<tt> [virtual slot]</tt></h3>
126
124
<p>Clears the selection model. Emits <a href="qitemselectionmodel.html#selectionChanged">selectionChanged</a>() and <a href="qitemselectionmodel.html#currentChanged">currentChanged</a>().</p>
 
125
<h3 class="fn"><a name="clearSelection"></a>void QItemSelectionModel::clearSelection ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
 
126
<p>Clears the selection in the selection model. Emits <a href="qitemselectionmodel.html#selectionChanged">selectionChanged</a>().</p>
 
127
<p>This function was introduced in Qt 4.2.</p>
127
128
<h3 class="fn"><a name="columnIntersectsSelection"></a>bool QItemSelectionModel::columnIntersectsSelection ( int <i>column</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>parent</i> ) const</h3>
128
129
<p>Returns true if there are any items selected in the <i>column</i> with the given <i>parent</i>.</p>
129
130
<h3 class="fn"><a name="currentChanged"></a>void QItemSelectionModel::currentChanged ( const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>current</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>previous</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
130
131
<p>This signal is emitted whenever the current item changes. The <i>previous</i> model item index is replaced by the <i>current</i> index as the selection's current item.</p>
 
132
<p>Note that this signal will not be emitted when the item model is reset.</p>
131
133
<p>See also <a href="qitemselectionmodel.html#currentIndex">currentIndex</a>(), <a href="qitemselectionmodel.html#setCurrentIndex">setCurrentIndex</a>(), and <a href="qitemselectionmodel.html#selectionChanged">selectionChanged</a>().</p>
132
134
<h3 class="fn"><a name="currentColumnChanged"></a>void QItemSelectionModel::currentColumnChanged ( const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>current</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>previous</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
133
135
<p>This signal is emitted if the <i>current</i> item changes and its column is different to the column of the <i>previous</i> current item.</p>
 
136
<p>Note that this signal will not be emitted when the item model is reset.</p>
134
137
<p>See also <a href="qitemselectionmodel.html#currentChanged">currentChanged</a>(), <a href="qitemselectionmodel.html#currentRowChanged">currentRowChanged</a>(), <a href="qitemselectionmodel.html#currentIndex">currentIndex</a>(), and <a href="qitemselectionmodel.html#setCurrentIndex">setCurrentIndex</a>().</p>
135
138
<h3 class="fn"><a name="currentIndex"></a><a href="qmodelindex.html">QModelIndex</a> QItemSelectionModel::currentIndex () const</h3>
136
139
<p>Returns the model item index for the current item, or an invalid index if there is no current item.</p>
137
140
<p>See also <a href="qitemselectionmodel.html#setCurrentIndex">setCurrentIndex</a>().</p>
138
141
<h3 class="fn"><a name="currentRowChanged"></a>void QItemSelectionModel::currentRowChanged ( const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>current</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>previous</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
139
142
<p>This signal is emitted if the <i>current</i> item changes and its row is different to the row of the <i>previous</i> current item.</p>
 
143
<p>Note that this signal will not be emitted when the item model is reset.</p>
140
144
<p>See also <a href="qitemselectionmodel.html#currentChanged">currentChanged</a>(), <a href="qitemselectionmodel.html#currentColumnChanged">currentColumnChanged</a>(), <a href="qitemselectionmodel.html#currentIndex">currentIndex</a>(), and <a href="qitemselectionmodel.html#setCurrentIndex">setCurrentIndex</a>().</p>
141
145
<h3 class="fn"><a name="emitSelectionChanged"></a>void QItemSelectionModel::emitSelectionChanged ( const <a href="qitemselection.html">QItemSelection</a> &amp; <i>newSelection</i>, const <a href="qitemselection.html">QItemSelection</a> &amp; <i>oldSelection</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
142
146
<p>Compares the two selections <i>newSelection</i> and <i>oldSelection</i> and emits <a href="qitemselectionmodel.html#selectionChanged">selectionChanged</a>() with the deselected and selected items.</p>
 
147
<h3 class="fn"><a name="hasSelection"></a>bool QItemSelectionModel::hasSelection () const</h3>
 
148
<p>Returns true if the selection model contains any selection ranges; otherwise returns false.</p>
 
149
<p>This function was introduced in Qt 4.2.</p>
143
150
<h3 class="fn"><a name="isColumnSelected"></a>bool QItemSelectionModel::isColumnSelected ( int <i>column</i>, const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>parent</i> ) const</h3>
144
151
<p>Returns true if all items are selected in the <i>column</i> with the given <i>parent</i>.</p>
145
152
<p>Note that this function is usually faster than calling <a href="qitemselectionmodel.html#isSelected">isSelected</a>() on all items in the same column and that unselectable items are ignored.</p>
161
168
<p>This is an overloaded member function, provided for convenience.</p>
162
169
<p>Selects the item <i>selection</i> using the specified <i>command</i>, and emits <a href="qitemselectionmodel.html#selectionChanged">selectionChanged</a>().</p>
163
170
<p>See also <a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::SelectionFlag</a>.</p>
 
171
<h3 class="fn"><a name="selectedColumns"></a><a href="qmodelindex.html#QModelIndexList-typedef">QModelIndexList</a> QItemSelectionModel::selectedColumns ( int <i>row</i> = 0 ) const</h3>
 
172
<p>Returns the indexes in the given <i>row</i> for columns where all rows are selected.</p>
 
173
<p>This function was introduced in Qt 4.2.</p>
 
174
<p>See also <a href="qitemselectionmodel.html#selectedIndexes">selectedIndexes</a>() and <a href="qitemselectionmodel.html#selectedRows">selectedRows</a>().</p>
164
175
<h3 class="fn"><a name="selectedIndexes"></a><a href="qmodelindex.html#QModelIndexList-typedef">QModelIndexList</a> QItemSelectionModel::selectedIndexes () const</h3>
165
176
<p>Returns a list of all selected model item indexes. The list contains no duplicates, and is not sorted.</p>
 
177
<h3 class="fn"><a name="selectedRows"></a><a href="qmodelindex.html#QModelIndexList-typedef">QModelIndexList</a> QItemSelectionModel::selectedRows ( int <i>column</i> = 0 ) const</h3>
 
178
<p>Returns the indexes in the given <i>column</i> for the rows where all columns are selected.</p>
 
179
<p>This function was introduced in Qt 4.2.</p>
 
180
<p>See also <a href="qitemselectionmodel.html#selectedIndexes">selectedIndexes</a>() and <a href="qitemselectionmodel.html#selectedColumns">selectedColumns</a>().</p>
166
181
<h3 class="fn"><a name="selection"></a>const <a href="qitemselection.html">QItemSelection</a> QItemSelectionModel::selection () const</h3>
167
182
<p>Returns the selection ranges stored in the selection model.</p>
168
183
<h3 class="fn"><a name="selectionChanged"></a>void QItemSelectionModel::selectionChanged ( const <a href="qitemselection.html">QItemSelection</a> &amp; <i>selected</i>, const <a href="qitemselection.html">QItemSelection</a> &amp; <i>deselected</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
169
184
<p>This signal is emitted whenever the selection changes. The change in the selection is represented as an item selection of <i>deselected</i> items and an item selection of <i>selected</i> items.</p>
170
 
<p>Note the that the current index changes independently from the selection.</p>
 
185
<p>Note the that the current index changes independently from the selection. Also note that this signal will not be emitted when the item model is reset.</p>
171
186
<p>See also <a href="qitemselectionmodel.html#select">select</a>() and <a href="qitemselectionmodel.html#currentChanged">currentChanged</a>().</p>
172
187
<h3 class="fn"><a name="setCurrentIndex"></a>void QItemSelectionModel::setCurrentIndex ( const <a href="qmodelindex.html">QModelIndex</a> &amp; <i>index</i>, <a href="qitemselectionmodel.html#SelectionFlag-enum">QItemSelectionModel::SelectionFlags</a> <i>command</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
173
188
<p>Sets the model item <i>index</i> to be the current item, and emits <a href="qitemselectionmodel.html#currentChanged">currentChanged</a>(). The current item is used for keyboard navigation and focus indication; it is independent of any selected items, although a selected item can also be the current item.</p>
177
192
<table width="100%" cellspacing="0" border="0"><tr class="address">
178
193
<td width="30%">Copyright &copy; 2006 <a href="trolltech.html">Trolltech</a></td>
179
194
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
180
 
<td width="30%" align="right"><div align="right">Qt 4.1.4</div></td>
 
195
<td width="30%" align="right"><div align="right">Qt 4.2.0</div></td>
181
196
</tr></table></div></address></body>
182
197
</html>