source: trunk/doc/html/qlistview.html

Last change on this file was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 84.4 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qlistview.cpp:2407 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QListView Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QListView Class Reference</h1>
33
34<p>The QListView class implements a list/tree view.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qlistview-h.html">qlistview.h</a>&gt;</tt>
37<p>Inherits <a href="qscrollview.html">QScrollView</a>.
38<p><a href="qlistview-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QListView"><b>QListView</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )</li>
42<li class=fn><a href="#~QListView"><b>~QListView</b></a> ()</li>
43<li class=fn>int <a href="#treeStepSize"><b>treeStepSize</b></a> () const</li>
44<li class=fn>virtual void <a href="#setTreeStepSize"><b>setTreeStepSize</b></a> ( int )</li>
45<li class=fn>virtual void <a href="#insertItem"><b>insertItem</b></a> ( QListViewItem&nbsp;*&nbsp;i )</li>
46<li class=fn>virtual void <a href="#takeItem"><b>takeItem</b></a> ( QListViewItem&nbsp;*&nbsp;i )</li>
47<li class=fn>virtual void removeItem ( QListViewItem&nbsp;*&nbsp;item ) &nbsp;<em>(obsolete)</em></li>
48<li class=fn>QHeader * <a href="#header"><b>header</b></a> () const</li>
49<li class=fn>virtual int <a href="#addColumn"><b>addColumn</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;label, int&nbsp;width = -1 )</li>
50<li class=fn>virtual int <a href="#addColumn-2"><b>addColumn</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;iconset, const&nbsp;QString&nbsp;&amp;&nbsp;label, int&nbsp;width = -1 )</li>
51<li class=fn>virtual void <a href="#removeColumn"><b>removeColumn</b></a> ( int&nbsp;index )</li>
52<li class=fn>virtual void <a href="#setColumnText"><b>setColumnText</b></a> ( int&nbsp;column, const&nbsp;QString&nbsp;&amp;&nbsp;label )</li>
53<li class=fn>virtual void <a href="#setColumnText-2"><b>setColumnText</b></a> ( int&nbsp;column, const&nbsp;QIconSet&nbsp;&amp;&nbsp;iconset, const&nbsp;QString&nbsp;&amp;&nbsp;label )</li>
54<li class=fn>QString <a href="#columnText"><b>columnText</b></a> ( int&nbsp;c ) const</li>
55<li class=fn>virtual void <a href="#setColumnWidth"><b>setColumnWidth</b></a> ( int&nbsp;column, int&nbsp;w )</li>
56<li class=fn>int <a href="#columnWidth"><b>columnWidth</b></a> ( int&nbsp;c ) const</li>
57<li class=fn>enum <a href="#WidthMode-enum"><b>WidthMode</b></a> { Manual, Maximum }</li>
58<li class=fn>virtual void <a href="#setColumnWidthMode"><b>setColumnWidthMode</b></a> ( int&nbsp;c, WidthMode&nbsp;mode )</li>
59<li class=fn>WidthMode <a href="#columnWidthMode"><b>columnWidthMode</b></a> ( int&nbsp;c ) const</li>
60<li class=fn>int <a href="#columns"><b>columns</b></a> () const</li>
61<li class=fn>virtual void <a href="#setColumnAlignment"><b>setColumnAlignment</b></a> ( int&nbsp;column, int&nbsp;align )</li>
62<li class=fn>int <a href="#columnAlignment"><b>columnAlignment</b></a> ( int&nbsp;column ) const</li>
63<li class=fn>QListViewItem * <a href="#itemAt"><b>itemAt</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;viewPos ) const</li>
64<li class=fn>QRect <a href="#itemRect"><b>itemRect</b></a> ( const&nbsp;QListViewItem&nbsp;*&nbsp;i ) const</li>
65<li class=fn>int <a href="#itemPos"><b>itemPos</b></a> ( const&nbsp;QListViewItem&nbsp;*&nbsp;item )</li>
66<li class=fn>void <a href="#ensureItemVisible"><b>ensureItemVisible</b></a> ( const&nbsp;QListViewItem&nbsp;*&nbsp;i )</li>
67<li class=fn>void <a href="#repaintItem"><b>repaintItem</b></a> ( const&nbsp;QListViewItem&nbsp;*&nbsp;item ) const</li>
68<li class=fn>virtual void setMultiSelection ( bool&nbsp;enable ) &nbsp;<em>(obsolete)</em></li>
69<li class=fn>bool isMultiSelection () const &nbsp;<em>(obsolete)</em></li>
70<li class=fn>enum <a href="#SelectionMode-enum"><b>SelectionMode</b></a> { Single, Multi, Extended, NoSelection }</li>
71<li class=fn>void <a href="#setSelectionMode"><b>setSelectionMode</b></a> ( SelectionMode&nbsp;mode )</li>
72<li class=fn>SelectionMode <a href="#selectionMode"><b>selectionMode</b></a> () const</li>
73<li class=fn>virtual void <a href="#clearSelection"><b>clearSelection</b></a> ()</li>
74<li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( QListViewItem&nbsp;*&nbsp;item, bool&nbsp;selected )</li>
75<li class=fn>void <a href="#setSelectionAnchor"><b>setSelectionAnchor</b></a> ( QListViewItem&nbsp;*&nbsp;item )</li>
76<li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> ( const&nbsp;QListViewItem&nbsp;*&nbsp;i ) const</li>
77<li class=fn>QListViewItem * <a href="#selectedItem"><b>selectedItem</b></a> () const</li>
78<li class=fn>virtual void <a href="#setOpen"><b>setOpen</b></a> ( QListViewItem&nbsp;*&nbsp;item, bool&nbsp;open )</li>
79<li class=fn>bool <a href="#isOpen"><b>isOpen</b></a> ( const&nbsp;QListViewItem&nbsp;*&nbsp;item ) const</li>
80<li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( QListViewItem&nbsp;*&nbsp;i )</li>
81<li class=fn>QListViewItem * <a href="#currentItem"><b>currentItem</b></a> () const</li>
82<li class=fn>QListViewItem * <a href="#firstChild"><b>firstChild</b></a> () const</li>
83<li class=fn>QListViewItem * <a href="#lastItem"><b>lastItem</b></a> () const</li>
84<li class=fn>int <a href="#childCount"><b>childCount</b></a> () const</li>
85<li class=fn>virtual void <a href="#setAllColumnsShowFocus"><b>setAllColumnsShowFocus</b></a> ( bool )</li>
86<li class=fn>bool <a href="#allColumnsShowFocus"><b>allColumnsShowFocus</b></a> () const</li>
87<li class=fn>virtual void <a href="#setItemMargin"><b>setItemMargin</b></a> ( int )</li>
88<li class=fn>int <a href="#itemMargin"><b>itemMargin</b></a> () const</li>
89<li class=fn>virtual void <a href="#setRootIsDecorated"><b>setRootIsDecorated</b></a> ( bool )</li>
90<li class=fn>bool <a href="#rootIsDecorated"><b>rootIsDecorated</b></a> () const</li>
91<li class=fn>virtual void <a href="#setSorting"><b>setSorting</b></a> ( int&nbsp;column, bool&nbsp;ascending = TRUE )</li>
92<li class=fn>int <a href="#sortColumn"><b>sortColumn</b></a> () const</li>
93<li class=fn>void <a href="#setSortColumn"><b>setSortColumn</b></a> ( int&nbsp;column )</li>
94<li class=fn>SortOrder <a href="#sortOrder"><b>sortOrder</b></a> () const</li>
95<li class=fn>void <a href="#setSortOrder"><b>setSortOrder</b></a> ( SortOrder&nbsp;order )</li>
96<li class=fn>virtual void <a href="#sort"><b>sort</b></a> ()</li>
97<li class=fn>virtual bool <a href="#eventFilter"><b>eventFilter</b></a> ( QObject&nbsp;*&nbsp;o, QEvent&nbsp;*&nbsp;e )</li>
98<li class=fn>virtual void <a href="#setShowSortIndicator"><b>setShowSortIndicator</b></a> ( bool&nbsp;show )</li>
99<li class=fn>bool <a href="#showSortIndicator"><b>showSortIndicator</b></a> () const</li>
100<li class=fn>virtual void <a href="#setShowToolTips"><b>setShowToolTips</b></a> ( bool&nbsp;b )</li>
101<li class=fn>bool <a href="#showToolTips"><b>showToolTips</b></a> () const</li>
102<li class=fn>enum <a href="#ResizeMode-enum"><b>ResizeMode</b></a> { NoColumn, AllColumns, LastColumn }</li>
103<li class=fn>virtual void <a href="#setResizeMode"><b>setResizeMode</b></a> ( ResizeMode&nbsp;m )</li>
104<li class=fn>ResizeMode <a href="#resizeMode"><b>resizeMode</b></a> () const</li>
105<li class=fn>QListViewItem * <a href="#findItem"><b>findItem</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;column, ComparisonFlags&nbsp;compare = ExactMatch | CaseSensitive ) const</li>
106<li class=fn>enum <a href="#RenameAction-enum"><b>RenameAction</b></a> { Accept, Reject }</li>
107<li class=fn>virtual void <a href="#setDefaultRenameAction"><b>setDefaultRenameAction</b></a> ( RenameAction&nbsp;a )</li>
108<li class=fn>RenameAction <a href="#defaultRenameAction"><b>defaultRenameAction</b></a> () const</li>
109<li class=fn>bool <a href="#isRenaming"><b>isRenaming</b></a> () const</li>
110<li class=fn>void <a href="#hideColumn"><b>hideColumn</b></a> ( int&nbsp;column )</li>
111</ul>
112<h2>Public Slots</h2>
113<ul>
114<li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li>
115<li class=fn>virtual void <a href="#invertSelection"><b>invertSelection</b></a> ()</li>
116<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool&nbsp;select )</li>
117<li class=fn>void <a href="#triggerUpdate"><b>triggerUpdate</b></a> ()</li>
118<li class=fn>void <a href="#adjustColumn"><b>adjustColumn</b></a> ( int&nbsp;col )</li>
119</ul>
120<h2>Signals</h2>
121<ul>
122<li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
123<li class=fn>void <a href="#selectionChanged-2"><b>selectionChanged</b></a> ( QListViewItem * )</li>
124<li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( QListViewItem * )</li>
125<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( QListViewItem&nbsp;*&nbsp;item )</li>
126<li class=fn>void <a href="#clicked-2"><b>clicked</b></a> ( QListViewItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pnt, int&nbsp;c )</li>
127<li class=fn>void <a href="#pressed"><b>pressed</b></a> ( QListViewItem&nbsp;*&nbsp;item )</li>
128<li class=fn>void <a href="#pressed-2"><b>pressed</b></a> ( QListViewItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pnt, int&nbsp;c )</li>
129<li class=fn>void doubleClicked ( QListViewItem&nbsp;*&nbsp;item ) &nbsp;<em>(obsolete)</em></li>
130<li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( QListViewItem *, const QPoint &amp;, int )</li>
131<li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ( QListViewItem * )</li>
132<li class=fn>void <a href="#spacePressed"><b>spacePressed</b></a> ( QListViewItem * )</li>
133<li class=fn>void <a href="#rightButtonClicked"><b>rightButtonClicked</b></a> ( QListViewItem *, const QPoint &amp;, int )</li>
134<li class=fn>void <a href="#rightButtonPressed"><b>rightButtonPressed</b></a> ( QListViewItem *, const QPoint &amp;, int )</li>
135<li class=fn>void <a href="#mouseButtonPressed"><b>mouseButtonPressed</b></a> ( int&nbsp;button, QListViewItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, int&nbsp;c )</li>
136<li class=fn>void <a href="#mouseButtonClicked"><b>mouseButtonClicked</b></a> ( int&nbsp;button, QListViewItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, int&nbsp;c )</li>
137<li class=fn>void <a href="#contextMenuRequested"><b>contextMenuRequested</b></a> ( QListViewItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos, int&nbsp;col )</li>
138<li class=fn>void <a href="#onItem"><b>onItem</b></a> ( QListViewItem&nbsp;*&nbsp;i )</li>
139<li class=fn>void <a href="#onViewport"><b>onViewport</b></a> ()</li>
140<li class=fn>void <a href="#expanded"><b>expanded</b></a> ( QListViewItem&nbsp;*&nbsp;item )</li>
141<li class=fn>void <a href="#collapsed"><b>collapsed</b></a> ( QListViewItem&nbsp;*&nbsp;item )</li>
142<li class=fn>void <a href="#dropped"><b>dropped</b></a> ( QDropEvent&nbsp;*&nbsp;e )</li>
143<li class=fn>void <a href="#itemRenamed"><b>itemRenamed</b></a> ( QListViewItem&nbsp;*&nbsp;item, int&nbsp;col, const&nbsp;QString&nbsp;&amp;&nbsp;text )</li>
144<li class=fn>void <a href="#itemRenamed-2"><b>itemRenamed</b></a> ( QListViewItem&nbsp;*&nbsp;item, int&nbsp;col )</li>
145</ul>
146<h2>Properties</h2>
147<ul>
148<li class=fn>bool <a href="#allColumnsShowFocus-prop"><b>allColumnsShowFocus</b></a>&nbsp;- whether items should show keyboard focus using all columns</li>
149<li class=fn>int <a href="#childCount-prop"><b>childCount</b></a>&nbsp;- the number of parentless (top-level) QListViewItem objects in this QListView &nbsp;<em>(read only)</em></li>
150<li class=fn>int <a href="#columns-prop"><b>columns</b></a>&nbsp;- the number of columns in this list view &nbsp;<em>(read only)</em></li>
151<li class=fn>RenameAction <a href="#defaultRenameAction-prop"><b>defaultRenameAction</b></a>&nbsp;- what action to perform when the editor loses focus during renaming</li>
152<li class=fn>int <a href="#itemMargin-prop"><b>itemMargin</b></a>&nbsp;- the advisory item margin that list items may use</li>
153<li class=fn>bool multiSelection&nbsp;- whether the list view is in multi-selection or extended-selection mode &nbsp;<em>(obsolete)</em></li>
154<li class=fn>ResizeMode <a href="#resizeMode-prop"><b>resizeMode</b></a>&nbsp;- whether all, none or the only the last column should be resized</li>
155<li class=fn>bool <a href="#rootIsDecorated-prop"><b>rootIsDecorated</b></a>&nbsp;- whether the list view shows open/close signs on root items</li>
156<li class=fn>SelectionMode <a href="#selectionMode-prop"><b>selectionMode</b></a>&nbsp;- the list view's selection mode</li>
157<li class=fn>bool <a href="#showSortIndicator-prop"><b>showSortIndicator</b></a>&nbsp;- whether the list view header should display a sort indicator</li>
158<li class=fn>bool <a href="#showToolTips-prop"><b>showToolTips</b></a>&nbsp;- whether this list view should show tooltips for truncated column texts</li>
159<li class=fn>int <a href="#treeStepSize-prop"><b>treeStepSize</b></a>&nbsp;- the number of pixels a child is offset from its parent</li>
160</ul>
161<h2>Protected Members</h2>
162<ul>
163<li class=fn>virtual void <a href="#contentsMousePressEvent"><b>contentsMousePressEvent</b></a> ( QMouseEvent&nbsp;*&nbsp;e )</li>
164<li class=fn>virtual void <a href="#contentsMouseReleaseEvent"><b>contentsMouseReleaseEvent</b></a> ( QMouseEvent&nbsp;*&nbsp;e )</li>
165<li class=fn>virtual void <a href="#contentsMouseMoveEvent"><b>contentsMouseMoveEvent</b></a> ( QMouseEvent&nbsp;*&nbsp;e )</li>
166<li class=fn>virtual void <a href="#contentsMouseDoubleClickEvent"><b>contentsMouseDoubleClickEvent</b></a> ( QMouseEvent&nbsp;*&nbsp;e )</li>
167<li class=fn>virtual QDragObject * <a href="#dragObject"><b>dragObject</b></a> ()</li>
168<li class=fn>virtual void <a href="#startDrag"><b>startDrag</b></a> ()</li>
169<li class=fn>virtual void <a href="#resizeEvent"><b>resizeEvent</b></a> ( QResizeEvent&nbsp;*&nbsp;e )</li>
170<li class=fn>virtual void <a href="#drawContentsOffset"><b>drawContentsOffset</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;ox, int&nbsp;oy, int&nbsp;cx, int&nbsp;cy, int&nbsp;cw, int&nbsp;ch )</li>
171<li class=fn>virtual void <a href="#paintEmptyArea"><b>paintEmptyArea</b></a> ( QPainter&nbsp;*&nbsp;p, const&nbsp;QRect&nbsp;&amp;&nbsp;rect )</li>
172</ul>
173<h2>Protected Slots</h2>
174<ul>
175<li class=fn>void <a href="#updateContents"><b>updateContents</b></a> ()</li>
176<li class=fn>void <a href="#doAutoScroll"><b>doAutoScroll</b></a> ()</li>
177</ul>
178<hr><a name="details"></a><h2>Detailed Description</h2>
179
180
181The QListView class implements a list/tree view.
182<p>
183
184<p> It can display and control a hierarchy of multi-column items, and
185provides the ability to add new items at any time. The user may
186select one or many items (depending on the <a href="#SelectionMode-enum">SelectionMode</a>) and
187sort the list in increasing or decreasing order by any column.
188<p> The simplest pattern of use is to create a QListView, add some
189column headers using <a href="#addColumn">addColumn</a>() and create one or more
190<a href="qlistviewitem.html">QListViewItem</a> or <a href="qchecklistitem.html">QCheckListItem</a> objects with the QListView as
191parent:
192<p>
193
194<pre> QListView * table;
195</pre>
196
197<pre> table-&gt;addColumn( "Qualified name" );
198 table-&gt;addColumn( "Namespace" );
199</pre><pre> element = new <a href="qlistviewitem.html">QListViewItem</a>( table, qName, namespaceURI );
200</pre>
201<p> Further nodes can be added to the list view object (the root of the
202tree) or as child nodes to QListViewItems:
203<p> <pre> <a name="x2105"></a> for ( int i = 0 ; i &lt; attributes.<a href="qxmlattributes.html#length">length</a>(); i++ ) {
204 <a name="x2107"></a><a name="x2106"></a> new <a href="qlistviewitem.html">QListViewItem</a>( element, attributes.<a href="qxmlattributes.html#qName">qName</a>(i), attributes.<a href="qxmlattributes.html#uri">uri</a>(i) );
205 }
206</pre>
207<p> (From <a href="tagreader-with-features-example.html">xml/tagreader-with-features/structureparser.cpp</a>)
208<p> The main setup functions are:
209<center><table cellpadding="4" cellspacing="2" border="0">
210<tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Action
211<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#addColumn">addColumn</a>()
212<td valign="top">Adds a column with a text label and perhaps width. Columns
213are counted from the left starting with column 0.
214<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#setColumnWidthMode">setColumnWidthMode</a>()
215<td valign="top">Sets the column to be resized automatically or not.
216<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#setAllColumnsShowFocus">setAllColumnsShowFocus</a>()
217<td valign="top">Sets whether items should show <a href="focus.html#keyboard-focus">keyboard focus</a> using all
218columns or just column 0. The default is to show focus
219just using column 0.
220<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#setRootIsDecorated">setRootIsDecorated</a>()
221<td valign="top">Sets whether root items should show open/close decoration to their left.
222The default is FALSE.
223<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#setTreeStepSize">setTreeStepSize</a>()
224<td valign="top">Sets how many pixels an item's children are indented
225relative to their parent. The default is 20. This is
226mostly a matter of taste.
227<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#setSorting">setSorting</a>()
228<td valign="top">Sets whether the items should be sorted, whether it should
229be in ascending or descending order, and by what column
230they should be sorted. By default the list view is sorted
231by the first column; to switch this off call <a href="#setSorting">setSorting</a>(-1).
232</table></center>
233<p> To handle events such as mouse presses on the list view, derived
234classes can reimplement the <a href="qscrollview.html">QScrollView</a> functions:
235<a href="qscrollview.html#contentsMousePressEvent">contentsMousePressEvent</a>,
236<a href="qscrollview.html#contentsMouseReleaseEvent">contentsMouseReleaseEvent</a>,
237<a href="qscrollview.html#contentsMouseDoubleClickEvent">contentsMouseDoubleClickEvent</a>,
238<a href="qscrollview.html#contentsMouseMoveEvent">contentsMouseMoveEvent</a>,
239<a href="qscrollview.html#contentsDragEnterEvent">contentsDragEnterEvent</a>,
240<a href="qscrollview.html#contentsDragMoveEvent">contentsDragMoveEvent</a>,
241<a href="qscrollview.html#contentsDragLeaveEvent">contentsDragLeaveEvent</a>,
242<a href="qscrollview.html#contentsDropEvent">contentsDropEvent</a>, and
243<a href="qscrollview.html#contentsWheelEvent">contentsWheelEvent</a>.
244<p> There are also several functions for mapping between items and
245coordinates. <a href="#itemAt">itemAt</a>() returns the item at a position on-screen,
246<a href="#itemRect">itemRect</a>() returns the rectangle an item occupies on the screen,
247and <a href="#itemPos">itemPos</a>() returns the position of any item (whether it is
248on-screen or not). <a href="#firstChild">firstChild</a>() returns the list view's first item
249(not necessarily visible on-screen).
250<p> You can iterate over visible items using
251<a href="qlistviewitem.html#itemBelow">QListViewItem::itemBelow</a>(); over a list view's top-level items
252using <a href="qlistviewitem.html#firstChild">QListViewItem::firstChild</a>() and
253<a href="qlistviewitem.html#nextSibling">QListViewItem::nextSibling</a>(); or every item using a
254<a href="qlistviewitemiterator.html">QListViewItemIterator</a>. See
255the <a href="qlistviewitem.html">QListViewItem</a> documentation for examples of traversal.
256<p> An item can be moved amongst its siblings using
257<a href="qlistviewitem.html#moveItem">QListViewItem::moveItem</a>(). To move an item in the hierarchy use
258<a href="#takeItem">takeItem</a>() and <a href="#insertItem">insertItem</a>(). Item's (and all their child items)
259are deleted with <tt>delete</tt>; to delete all the list view's items
260use <a href="#clear">clear</a>().
261<p> There are a variety of selection modes described in the
262QListView::SelectionMode documentation. The default is <a href="#SelectionMode-enum">Single</a>
263selection, which you can change using <a href="#setSelectionMode">setSelectionMode</a>().
264<p> Because QListView offers multiple selection it must display
265keyboard focus and selection state separately. Therefore there are
266functions both to set the selection state of an item
267(<a href="#setSelected">setSelected</a>()) and to set which item displays keyboard focus
268(<a href="#setCurrentItem">setCurrentItem</a>()).
269<p> QListView emits two groups of signals; one group signals changes
270in selection/focus state and one indicates selection. The first
271group consists of <a href="#selectionChanged">selectionChanged</a>() (applicable to all list
272views), selectionChanged(<a href="qlistviewitem.html">QListViewItem</a>*) (applicable only to a
273<a href="#SelectionMode-enum">Single</a> selection list view), and <a href="#currentChanged">currentChanged</a>(QListViewItem*).
274The second group consists of <a href="#doubleClicked">doubleClicked</a>(QListViewItem*),
275<a href="#returnPressed">returnPressed</a>(QListViewItem*),
276<a href="#rightButtonClicked">rightButtonClicked</a>(QListViewItem*, const <a href="qpoint.html">QPoint</a>&, int), etc.
277<p> Note that changing the state of the list view in a slot connected
278to a list view signal may cause unexpected side effects. If you
279need to change the list view's state in response to a signal, use
280a <a href="qtimer.html#singleShot">single shot timer</a> with a
281time out of 0, and connect this timer to a slot that modifies the
282list view's state.
283<p> In <a href="motif-extension.html#Motif">Motif</a> style, QListView deviates fairly strongly from the look
284and feel of the Motif hierarchical tree view. This is done mostly
285to provide a usable keyboard interface and to make the list view
286look better with a white background.
287<p> If <a href="#selectionMode">selectionMode</a>() is <a href="#SelectionMode-enum">Single</a> (the default) the user can select
288one item at a time, e.g. by clicking an item with the mouse, see
289<a href="#SelectionMode-enum">QListView::SelectionMode</a> for details.
290<p> The list view can be navigated either using the mouse or the
291keyboard. Clicking a <b>-</b> icon closes an item (hides its
292children) and clicking a <b>+</b> icon opens an item (shows its
293children). The keyboard controls are these:
294<center><table cellpadding="4" cellspacing="2" border="0">
295<tr bgcolor="#a2c511"> <th valign="top">Keypress <th valign="top">Action
296<tr bgcolor="#f0f0f0"> <td valign="top">Home
297<td valign="top">Make the first item current and visible.
298<tr bgcolor="#d0d0d0"> <td valign="top">End
299<td valign="top">Make the last item current and visible.
300<tr bgcolor="#f0f0f0"> <td valign="top">Page Up
301<td valign="top">Make the item above the top visible item current and visible.
302<tr bgcolor="#d0d0d0"> <td valign="top">Page Down
303<td valign="top">Make the item below the bottom visible item current and visible.
304<tr bgcolor="#f0f0f0"> <td valign="top">Up Arrow
305<td valign="top">Make the item above the current item current and visible.
306<tr bgcolor="#d0d0d0"> <td valign="top">Down Arrow
307<td valign="top">Make the item below the current item current and visible.
308<tr bgcolor="#f0f0f0"> <td valign="top">Left Arrow
309<td valign="top">If the current item is closed (<b>+</b> icon) or has no
310children, make its parent item current and visible. If the
311current item is open (<b>-</b> icon) close it, i.e. hide its
312children. Exception: if the current item is the first item
313and is closed and the horizontal scrollbar is offset to
314the right the list view will be scrolled left.
315<tr bgcolor="#d0d0d0"> <td valign="top">Right Arrow
316<td valign="top">If the current item is closed (<b>+</b> icon) and has
317children, the item is opened. If the current item is
318opened (<b>-</b> icon) and has children the item's first
319child is made current and visible. If the current item has
320no children the list view is scrolled right.
321</table></center>
322<p> If the user starts typing letters with the focus in the list view
323an incremental search will occur. For example if the user types
324'd' the current item will change to the first item that begins
325with the letter 'd'; if they then type 'a', the current item will
326change to the first item that begins with 'da', and so on. If no
327item begins with the letters they type the current item doesn't
328change.
329<p> <b>Warning:</b> The list view assumes ownership of all list view items
330and will delete them when it does not need them any more.
331<p> <img src=qlistview-m.png> <img src=qlistview-w.png>
332<p> <p>See also <a href="qlistviewitem.html">QListViewItem</a>, <a href="qchecklistitem.html">QCheckListItem</a>, and <a href="advanced.html">Advanced Widgets</a>.
333
334<hr><h2>Member Type Documentation</h2>
335<h3 class=fn><a name="RenameAction-enum"></a>QListView::RenameAction</h3>
336
337<p> This enum describes whether a rename operation is accepted if the
338rename editor loses focus without the user pressing Enter.
339<ul>
340<li><tt>QListView::Accept</tt> - Rename if Enter is pressed or focus is lost.
341<li><tt>QListView::Reject</tt> - Discard the rename operation if focus is lost (and
342Enter has not been pressed).
343</ul>
344<h3 class=fn><a name="ResizeMode-enum"></a>QListView::ResizeMode</h3>
345
346<p> This enum describes how the list view's header adjusts to resize
347events which affect the width of the list view.
348<ul>
349<li><tt>QListView::NoColumn</tt> - The columns do not get resized in resize events.
350<li><tt>QListView::AllColumns</tt> - All columns are resized equally to fit the width
351of the list view.
352<li><tt>QListView::LastColumn</tt> - The last column is resized to fit the width of
353the list view.
354</ul>
355<h3 class=fn><a name="SelectionMode-enum"></a>QListView::SelectionMode</h3>
356
357<p> This enumerated type is used by QListView to indicate how it
358reacts to selection by the user.
359<ul>
360<li><tt>QListView::Single</tt> - When the user selects an item, any already-selected
361item becomes unselected. The user can unselect the selected
362item by clicking on some empty space within the view.
363<li><tt>QListView::Multi</tt> - When the user selects an item in the usual way, the
364selection status of that item is toggled and the other items are
365left alone. Also, multiple items can be selected by dragging the
366mouse while the left mouse button stays pressed.
367<li><tt>QListView::Extended</tt> - When the user selects an item in the usual way,
368the selection is cleared and the new item selected. However, if
369the user presses the Ctrl key when clicking on an item, the
370clicked item gets toggled and all other items are left untouched.
371And if the user presses the Shift key while clicking on an item,
372all items between the current item and the clicked item get
373selected or unselected, depending on the state of the clicked
374item. Also, multiple items can be selected by dragging the mouse
375over them.
376<li><tt>QListView::NoSelection</tt> - Items cannot be selected.
377</ul><p> In other words, <a href="#SelectionMode-enum">Single</a> is a real single-selection list view, <a href="#SelectionMode-enum">Multi</a> a real multi-selection list view, <a href="#SelectionMode-enum">Extended</a> is a list view
378where users can select multiple items but usually want to select
379either just one or a range of contiguous items, and <a href="#SelectionMode-enum">NoSelection</a>
380is a list view where the user can look but not touch.
381
382<h3 class=fn><a name="WidthMode-enum"></a>QListView::WidthMode</h3>
383
384<p> This enum type describes how the width of a column in the view
385changes.
386<ul>
387<li><tt>QListView::Manual</tt> - the column width does not change automatically.
388<li><tt>QListView::Maximum</tt> - the column is automatically sized according to the
389widths of all items in the column. (Note: The column never shrinks
390in this case.) This means that the column is always resized to the
391width of the item with the largest width in the column.
392</ul><p> <p>See also <a href="#setColumnWidth">setColumnWidth</a>(), <a href="#setColumnWidthMode">setColumnWidthMode</a>(), and <a href="#columnWidth">columnWidth</a>().
393
394<hr><h2>Member Function Documentation</h2>
395<h3 class=fn><a name="QListView"></a>QListView::QListView ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
396</h3>
397Constructs a new empty list view called <em>name</em> with parent <em>parent</em>.
398<p> Performance is boosted by modifying the widget flags <em>f</em> so that
399only part of the <a href="qlistviewitem.html">QListViewItem</a> children is redrawn. This may be
400unsuitable for custom QListViewItem classes, in which case <a href="qt.html#WidgetFlags-enum">WStaticContents</a> and <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a> should be cleared.
401<p> <p>See also <a href="qwidget.html#clearWFlags">QWidget::clearWFlags</a>() and <a href="qt.html#WidgetFlags-enum">Qt::WidgetFlags</a>.
402
403<h3 class=fn><a name="~QListView"></a>QListView::~QListView ()
404</h3>
405Destroys the list view, deleting all its items, and frees up all
406allocated resources.
407
408<h3 class=fn>int <a name="addColumn"></a>QListView::addColumn ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label, int&nbsp;width = -1 )<tt> [virtual]</tt>
409</h3>
410Adds a <em>width</em> pixels wide column with the column header <em>label</em>
411to the list view, and returns the index of the new column.
412<p> All columns apart from the first one are inserted to the right of
413the existing ones.
414<p> If <em>width</em> is negative, the new column's <a href="#WidthMode-enum">WidthMode</a> is set to
415<a href="#WidthMode-enum">Maximum</a> instead of <a href="#WidthMode-enum">Manual</a>.
416<p> <p>See also <a href="#setColumnText">setColumnText</a>(), <a href="#setColumnWidth">setColumnWidth</a>(), and <a href="#setColumnWidthMode">setColumnWidthMode</a>().
417
418<p>Examples: <a href="addressbook-example.html#x585">addressbook/centralwidget.cpp</a>, <a href="checklists-example.html#x427">checklists/checklists.cpp</a>, <a href="dirview-example.html#x1714">dirview/main.cpp</a>, <a href="fileiconview-example.html#x886">fileiconview/mainwindow.cpp</a>, <a href="listviews-example.html#x141">listviews/listviews.cpp</a>, and <a href="qdir-example.html#x1827">qdir/qdir.cpp</a>.
419<h3 class=fn>int <a name="addColumn-2"></a>QListView::addColumn ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;iconset, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label, int&nbsp;width = -1 )<tt> [virtual]</tt>
420</h3>
421This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
422<p> Adds a <em>width</em> pixels wide new column with the header <em>label</em>
423and the <em>iconset</em> to the list view, and returns the index of the
424column.
425<p> If <em>width</em> is negative, the new column's <a href="#WidthMode-enum">WidthMode</a> is set to
426<a href="#WidthMode-enum">Maximum</a>, and to <a href="#WidthMode-enum">Manual</a> otherwise.
427<p> <p>See also <a href="#setColumnText">setColumnText</a>(), <a href="#setColumnWidth">setColumnWidth</a>(), and <a href="#setColumnWidthMode">setColumnWidthMode</a>().
428
429<h3 class=fn>void <a name="adjustColumn"></a>QListView::adjustColumn ( int&nbsp;col )<tt> [slot]</tt>
430</h3> Adjusts the column <em>col</em> to its preferred width
431<h3 class=fn>bool <a name="allColumnsShowFocus"></a>QListView::allColumnsShowFocus () const
432</h3><p>Returns TRUE if items should show keyboard focus using all columns; otherwise returns FALSE.
433See the <a href="qlistview.html#allColumnsShowFocus-prop">"allColumnsShowFocus"</a> property for details.
434<h3 class=fn>int <a name="childCount"></a>QListView::childCount () const
435</h3><p>Returns the number of parentless (top-level) <a href="qlistviewitem.html">QListViewItem</a> objects in this QListView.
436See the <a href="qlistview.html#childCount-prop">"childCount"</a> property for details.
437<h3 class=fn>void <a name="clear"></a>QListView::clear ()<tt> [virtual slot]</tt>
438</h3>
439Removes and deletes all the items in this list view and triggers
440an update.
441<p> Note that the <a href="#currentChanged">currentChanged</a>() signal is not emitted when this slot is invoked.
442<p>See also <a href="#triggerUpdate">triggerUpdate</a>().
443
444<p>Examples: <a href="addressbook-example.html#x586">addressbook/centralwidget.cpp</a>, <a href="checklists-example.html#x428">checklists/checklists.cpp</a>, <a href="listviews-example.html#x142">listviews/listviews.cpp</a>, and <a href="qaxcontainer-example-qutlook.html#x2725">qutlook/centralwidget.cpp</a>.
445<h3 class=fn>void <a name="clearSelection"></a>QListView::clearSelection ()<tt> [virtual]</tt>
446</h3>
447Sets all the items to be not selected, updates the list view as
448necessary, and emits the <a href="#selectionChanged">selectionChanged</a>() signals. Note that for
449<a href="#SelectionMode-enum">Multi</a> selection list views this function needs to iterate over
450<em>all</em> items.
451<p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="#multiSelection-prop">multiSelection</a>.
452
453<p>Example: <a href="addressbook-example.html#x587">addressbook/centralwidget.cpp</a>.
454<h3 class=fn>void <a name="clicked"></a>QListView::clicked ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
455</h3>
456
457<p> This signal is emitted whenever the user clicks (mouse pressed <em>and</em> mouse released) in the list view. <em>item</em> is the clicked list
458view item, or 0 if the user didn't click on an item.
459<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
460connected to this signal.
461
462<p>Example: <a href="addressbook-example.html#x588">addressbook/centralwidget.cpp</a>.
463<h3 class=fn>void <a name="clicked-2"></a>QListView::clicked ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pnt, int&nbsp;c )<tt> [signal]</tt>
464</h3>
465
466<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
467<p> This signal is emitted whenever the user clicks (mouse pressed <em>and</em> mouse released) in the list view. <em>item</em> is the clicked list
468view item, or 0 if the user didn't click on an item. <em>pnt</em> is the
469position where the user has clicked in global coordinates. If <em>item</em> is not 0, <em>c</em> is the list view column into which the user
470pressed; if <em>item</em> is 0 <em>c</em>'s value is undefined.
471<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
472connected to this signal.
473
474<h3 class=fn>void <a name="collapsed"></a>QListView::collapsed ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
475</h3>
476
477<p> This signal is emitted when the <em>item</em> has been collapsed, i.e.
478when the children of <em>item</em> are hidden.
479<p> <p>See also <a href="#setOpen">setOpen</a>() and <a href="#expanded">expanded</a>().
480
481<h3 class=fn>int <a name="columnAlignment"></a>QListView::columnAlignment ( int&nbsp;column ) const
482</h3>
483Returns the alignment of column <em>column</em>. The default is <a href="qt.html#AlignmentFlags-enum">AlignAuto</a>.
484<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>.
485
486<h3 class=fn><a href="qstring.html">QString</a> <a name="columnText"></a>QListView::columnText ( int&nbsp;c ) const
487</h3>
488Returns the text of column <em>c</em>.
489<p> <p>See also <a href="#setColumnText">setColumnText</a>().
490
491<h3 class=fn>int <a name="columnWidth"></a>QListView::columnWidth ( int&nbsp;c ) const
492</h3>
493Returns the width of column <em>c</em>.
494<p> <p>See also <a href="#setColumnWidth">setColumnWidth</a>().
495
496<h3 class=fn><a href="qlistview.html#WidthMode-enum">WidthMode</a> <a name="columnWidthMode"></a>QListView::columnWidthMode ( int&nbsp;c ) const
497</h3>
498Returns the <a href="#WidthMode-enum">WidthMode</a> for column <em>c</em>.
499<p> <p>See also <a href="#setColumnWidthMode">setColumnWidthMode</a>().
500
501<h3 class=fn>int <a name="columns"></a>QListView::columns () const
502</h3><p>Returns the number of columns in this list view.
503See the <a href="qlistview.html#columns-prop">"columns"</a> property for details.
504<h3 class=fn>void <a name="contentsMouseDoubleClickEvent"></a>QListView::contentsMouseDoubleClickEvent ( <a href="qmouseevent.html">QMouseEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
505</h3>
506Processes the mouse double-click event <em>e</em> on behalf of the viewed widget.
507
508<p>Reimplemented from <a href="qscrollview.html#contentsMouseDoubleClickEvent">QScrollView</a>.
509<h3 class=fn>void <a name="contentsMouseMoveEvent"></a>QListView::contentsMouseMoveEvent ( <a href="qmouseevent.html">QMouseEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
510</h3>
511Processes the mouse move event <em>e</em> on behalf of the viewed widget.
512
513<p>Example: <a href="dirview-example.html#x1683">dirview/dirview.cpp</a>.
514<p>Reimplemented from <a href="qscrollview.html#contentsMouseMoveEvent">QScrollView</a>.
515<h3 class=fn>void <a name="contentsMousePressEvent"></a>QListView::contentsMousePressEvent ( <a href="qmouseevent.html">QMouseEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
516</h3>
517Processes the mouse press event <em>e</em> on behalf of the viewed widget.
518
519<p>Example: <a href="dirview-example.html#x1684">dirview/dirview.cpp</a>.
520<p>Reimplemented from <a href="qscrollview.html#contentsMousePressEvent">QScrollView</a>.
521<h3 class=fn>void <a name="contentsMouseReleaseEvent"></a>QListView::contentsMouseReleaseEvent ( <a href="qmouseevent.html">QMouseEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
522</h3>
523Processes the mouse release event <em>e</em> on behalf of the viewed widget.
524
525<p>Example: <a href="dirview-example.html#x1685">dirview/dirview.cpp</a>.
526<p>Reimplemented from <a href="qscrollview.html#contentsMouseReleaseEvent">QScrollView</a>.
527<h3 class=fn>void <a name="contextMenuRequested"></a>QListView::contextMenuRequested ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, int&nbsp;col )<tt> [signal]</tt>
528</h3>
529
530<p> This signal is emitted when the user invokes a context menu with
531the right mouse button or with special system keys. If the
532keyboard was used <em>item</em> is the current item; if the mouse was
533used, <em>item</em> is the item under the mouse pointer or 0 if there is
534no item under the mouse pointer. If no item is clicked, the column
535index emitted is -1.
536<p> <em>pos</em> is the position for the context menu in the global
537coordinate system.
538<p> <em>col</em> is the column on which the user pressed, or -1 if the
539signal was triggered by a key event.
540
541<p>Example: <a href="listviews-example.html#x143">listviews/listviews.cpp</a>.
542<h3 class=fn>void <a name="currentChanged"></a>QListView::currentChanged ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;* )<tt> [signal]</tt>
543</h3>
544
545<p> This signal is emitted whenever the current item has changed
546(normally after the screen update). The current item is the item
547responsible for indicating <a href="focus.html#keyboard-focus">keyboard focus</a>.
548<p> The argument is the newly current item, or 0 if the change made no
549item current. This can happen, for example, if all items in the
550list view are deleted.
551<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
552connected to this signal.
553<p> <p>See also <a href="#setCurrentItem">setCurrentItem</a>() and <a href="#currentItem">currentItem</a>().
554
555<p>Example: <a href="listviews-example.html#x144">listviews/listviews.cpp</a>.
556<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a>&nbsp;* <a name="currentItem"></a>QListView::currentItem () const
557</h3>
558Returns the current item, or 0 if there isn't one.
559<p> <p>See also <a href="#setCurrentItem">setCurrentItem</a>().
560
561<p>Examples: <a href="addressbook-example.html#x589">addressbook/centralwidget.cpp</a>, <a href="listviews-example.html#x145">listviews/listviews.cpp</a>, and <a href="qaxcontainer-example-qutlook.html#x2726">qutlook/centralwidget.cpp</a>.
562<h3 class=fn><a href="qlistview.html#RenameAction-enum">RenameAction</a> <a name="defaultRenameAction"></a>QListView::defaultRenameAction () const
563</h3><p>Returns what action to perform when the editor loses focus during renaming.
564See the <a href="qlistview.html#defaultRenameAction-prop">"defaultRenameAction"</a> property for details.
565<h3 class=fn>void <a name="doAutoScroll"></a>QListView::doAutoScroll ()<tt> [protected slot]</tt>
566</h3>
567This slot handles auto-scrolling when the mouse button is pressed
568and the mouse is outside the widget.
569
570<h3 class=fn>void <a name="doubleClicked"></a>QListView::doubleClicked ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;, int )<tt> [signal]</tt>
571</h3>
572
573<p> This signal is emitted whenever an item is double-clicked. It's
574emitted on the second button press, not the second button release.
575The arguments are the relevant <a href="qlistviewitem.html">QListViewItem</a> (may be 0), the point
576in global coordinates and the relevant column (or -1 if the click
577was outside the list).
578<p> <b>Warning:</b> Do not delete any QListViewItem objects in slots
579connected to this signal.
580
581<h3 class=fn>void <a name="doubleClicked-2"></a>QListView::doubleClicked ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
582</h3>
583
584<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
585(use <a href="#doubleClicked">doubleClicked</a>( <a href="qlistviewitem.html">QListViewItem</a> *, const <a href="qpoint.html">QPoint</a>&, int ))
586<p> This signal is emitted whenever an item is double-clicked. It's
587emitted on the second button press, not the second button release.
588<em>item</em> is the list view item on which the user did the
589double-click.
590
591<h3 class=fn><a href="qdragobject.html">QDragObject</a>&nbsp;* <a name="dragObject"></a>QListView::dragObject ()<tt> [virtual protected]</tt>
592</h3>
593If the user presses the mouse on an item and starts moving the
594mouse, and the item allow dragging (see
595<a href="qlistviewitem.html#setDragEnabled">QListViewItem::setDragEnabled</a>()), this function is called to get a
596drag object and a drag is started unless <a href="#dragObject">dragObject</a>() returns 0.
597<p> By default this function returns 0. You should reimplement it and
598create a <a href="qdragobject.html">QDragObject</a> depending on the selected items.
599
600<h3 class=fn>void <a name="drawContentsOffset"></a>QListView::drawContentsOffset ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;ox, int&nbsp;oy, int&nbsp;cx, int&nbsp;cy, int&nbsp;cw, int&nbsp;ch )<tt> [virtual protected]</tt>
601</h3>
602Calls <a href="qlistviewitem.html#paintCell">QListViewItem::paintCell</a>() and
603<a href="qlistviewitem.html#paintBranches">QListViewItem::paintBranches</a>() as necessary for all list view
604items that require repainting in the <em>cw</em> pixels wide and <em>ch</em>
605pixels high bounding rectangle starting at position <em>cx</em>, <em>cy</em>
606with offset <em>ox</em>, <em>oy</em>. Uses the painter <em>p</em>.
607
608<p>Reimplemented from <a href="qscrollview.html#drawContentsOffset">QScrollView</a>.
609<h3 class=fn>void <a name="dropped"></a>QListView::dropped ( <a href="qdropevent.html">QDropEvent</a>&nbsp;*&nbsp;e )<tt> [signal]</tt>
610</h3>
611
612<p> This signal is emitted, when a drop event occurred on the
613viewport (not onto an item).
614<p> <em>e</em> provides all the information about the drop.
615
616<h3 class=fn>void <a name="ensureItemVisible"></a>QListView::ensureItemVisible ( const&nbsp;<a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;i )
617</h3>
618Ensures that item <em>i</em> is visible, scrolling the list view
619vertically if necessary and opening (expanding) any parent items
620if this is required to show the item.
621<p> <p>See also <a href="#itemRect">itemRect</a>() and <a href="qscrollview.html#ensureVisible">QScrollView::ensureVisible</a>().
622
623<h3 class=fn>bool <a name="eventFilter"></a>QListView::eventFilter ( <a href="qobject.html">QObject</a>&nbsp;*&nbsp;o, <a href="qevent.html">QEvent</a>&nbsp;*&nbsp;e )<tt> [virtual]</tt>
624</h3>
625Redirects the event <em>e</em> relating to object <em>o</em>, for the viewport
626to <a href="qwidget.html#mousePressEvent">mousePressEvent</a>(), <a href="qwidget.html#keyPressEvent">keyPressEvent</a>() and friends.
627
628<p>Reimplemented from <a href="qscrollview.html#eventFilter">QScrollView</a>.
629<h3 class=fn>void <a name="expanded"></a>QListView::expanded ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
630</h3>
631
632<p> This signal is emitted when <em>item</em> has been expanded, i.e. when
633the children of <em>item</em> are shown.
634<p> <p>See also <a href="#setOpen">setOpen</a>() and <a href="#collapsed">collapsed</a>().
635
636<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a>&nbsp;* <a name="findItem"></a>QListView::findItem ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;column, ComparisonFlags&nbsp;compare = ExactMatch | CaseSensitive ) const
637</h3>
638Finds the first list view item in column <em>column</em>, that matches
639<em>text</em> and returns the item, or returns 0 of no such item could
640be found.
641The search starts from the current item if the current item exists,
642otherwise it starts from the first list view item. After reaching
643the last item the search continues from the first item.
644Pass OR-ed together <a href="qt.html#StringComparisonMode-enum">Qt::StringComparisonMode</a> values
645in the <em>compare</em> flag, to control how the matching is performed.
646The default comparison mode is case-sensitive, exact match.
647
648<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a>&nbsp;* <a name="firstChild"></a>QListView::firstChild () const
649</h3>
650Returns the first item in this QListView. Returns 0 if there is no
651first item.
652<p> A list view's items can be traversed using <a href="#firstChild">firstChild</a>()
653and nextSibling() or using a <a href="qlistviewitemiterator.html">QListViewItemIterator</a>.
654<p> <p>See also <a href="#itemAt">itemAt</a>(), <a href="qlistviewitem.html#itemBelow">QListViewItem::itemBelow</a>(), and <a href="qlistviewitem.html#itemAbove">QListViewItem::itemAbove</a>().
655
656<p>Examples: <a href="addressbook-example.html#x590">addressbook/centralwidget.cpp</a> and <a href="listviews-example.html#x146">listviews/listviews.cpp</a>.
657<h3 class=fn><a href="qheader.html">QHeader</a>&nbsp;* <a name="header"></a>QListView::header () const
658</h3>
659Returns the <a href="qheader.html">QHeader</a> object that manages this list view's columns.
660Please don't modify the header behind the list view's back.
661<p> You may safely call <a href="qheader.html#setClickEnabled">QHeader::setClickEnabled</a>(),
662<a href="qheader.html#setResizeEnabled">QHeader::setResizeEnabled</a>(), <a href="qheader.html#setMovingEnabled">QHeader::setMovingEnabled</a>(),
663<a href="qwidget.html#hide">QHeader::hide</a>() and all the const QHeader functions.
664
665<p>Examples: <a href="listviews-example.html#x147">listviews/listviews.cpp</a> and <a href="qdir-example.html#x1828">qdir/qdir.cpp</a>.
666<h3 class=fn>void <a name="hideColumn"></a>QListView::hideColumn ( int&nbsp;column )
667</h3>
668Hides the column specified at <em>column</em>. This is a convenience
669function that calls <a href="#setColumnWidth">setColumnWidth</a>( <em>column</em>, 0 ).
670<p> Note: The user may still be able to resize the hidden column using
671the header handles. To prevent this, call setResizeEnabled(FALSE,
672<em>column</em>) on the list views header.
673<p> <p>See also <a href="#setColumnWidth">setColumnWidth</a>().
674
675<h3 class=fn>void <a name="insertItem"></a>QListView::insertItem ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;i )<tt> [virtual]</tt>
676</h3>
677Inserts item <em>i</em> into the list view as a top-level item. You do
678not need to call this unless you've called <a href="#takeItem">takeItem</a>(<em>i</em>) or
679<a href="qlistviewitem.html#takeItem">QListViewItem::takeItem</a>(<em>i</em>) and need to reinsert <em>i</em> elsewhere.
680<p> <p>See also <a href="qlistviewitem.html#takeItem">QListViewItem::takeItem</a>() and <a href="#takeItem">takeItem</a>().
681
682<h3 class=fn>void <a name="invertSelection"></a>QListView::invertSelection ()<tt> [virtual slot]</tt>
683</h3>
684Inverts the selection. Only works in <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a>
685selection modes.
686
687<h3 class=fn>bool <a name="isMultiSelection"></a>QListView::isMultiSelection () const
688</h3><p>Returns TRUE if the list view is in multi-selection or extended-selection mode; otherwise returns FALSE.
689See the <a href="qlistview.html#multiSelection-prop">"multiSelection"</a> property for details.
690<h3 class=fn>bool <a name="isOpen"></a>QListView::isOpen ( const&nbsp;<a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item ) const
691</h3>
692Identical to <em>item</em>->isOpen(). Provided for completeness.
693<p> <p>See also <a href="#setOpen">setOpen</a>().
694
695<h3 class=fn>bool <a name="isRenaming"></a>QListView::isRenaming () const
696</h3>
697Returns TRUE if an item is being renamed; otherwise returns FALSE.
698
699<h3 class=fn>bool <a name="isSelected"></a>QListView::isSelected ( const&nbsp;<a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;i ) const
700</h3>
701Returns TRUE if the list view item <em>i</em> is selected; otherwise
702returns FALSE.
703<p> <p>See also <a href="qlistviewitem.html#isSelected">QListViewItem::isSelected</a>().
704
705<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a>&nbsp;* <a name="itemAt"></a>QListView::itemAt ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;viewPos ) const
706</h3>
707Returns the list view item at <em>viewPos</em>. Note that <em>viewPos</em> is
708in the <a href="qscrollview.html#viewport">viewport</a>()'s coordinate system, not in the list view's own,
709much larger, coordinate system.
710<p> <a href="#itemAt">itemAt</a>() returns 0 if there is no such item.
711<p> Note that you also get the pointer to the item if <em>viewPos</em>
712points to the root decoration (see <a href="#setRootIsDecorated">setRootIsDecorated</a>()) of the
713item. To check whether or not <em>viewPos</em> is on the root decoration
714of the item, you can do something like this:
715<p> <pre>
716 <a href="qlistviewitem.html">QListViewItem</a> *i = <a href="#itemAt">itemAt</a>( p );
717 if ( i ) {
718 if ( p.x() &gt; header()-&gt;sectionPos( <a href="#header">header</a>()-&gt;mapToIndex( 0 ) ) +
719 <a href="#treeStepSize">treeStepSize</a>() * ( i-&gt;<a href="qlistviewitem.html#depth">depth</a>() + ( <a href="#rootIsDecorated">rootIsDecorated</a>() ? 1 : 0) ) + itemMargin() ||
720 p.x() &lt; header()-&gt;sectionPos( <a href="#header">header</a>()-&gt;mapToIndex( 0 ) ) ) {
721 ; // p is not on root decoration
722 else
723 ; // p is on the root decoration
724 }
725 </pre>
726
727<p> This might be interesting if you use this function to find out
728where the user clicked and if you want to start a drag (which you
729do not want to do if the user clicked onto the root decoration of
730an item).
731<p> <p>See also <a href="#itemPos">itemPos</a>(), <a href="#itemRect">itemRect</a>(), and <a href="qscrollview.html#viewportToContents">viewportToContents</a>().
732
733<h3 class=fn>int <a name="itemMargin"></a>QListView::itemMargin () const
734</h3><p>Returns the advisory item margin that list items may use.
735See the <a href="qlistview.html#itemMargin-prop">"itemMargin"</a> property for details.
736<h3 class=fn>int <a name="itemPos"></a>QListView::itemPos ( const&nbsp;<a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item )
737</h3>
738Returns the y-coordinate of <em>item</em> in the list view's coordinate
739system. This function is normally much slower than <a href="#itemAt">itemAt</a>() but it
740works for all items, whereas itemAt() normally works only for
741items on the screen.
742<p> This is a thin wrapper around <a href="qlistviewitem.html#itemPos">QListViewItem::itemPos</a>().
743<p> <p>See also <a href="#itemAt">itemAt</a>() and <a href="#itemRect">itemRect</a>().
744
745<h3 class=fn><a href="qrect.html">QRect</a> <a name="itemRect"></a>QListView::itemRect ( const&nbsp;<a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;i ) const
746</h3>
747Returns the rectangle on the screen that item <em>i</em> occupies in
748<a href="qscrollview.html#viewport">viewport</a>()'s coordinates, or an invalid rectangle if <em>i</em> is 0 or
749is not currently visible.
750<p> The rectangle returned does not include any children of the
751rectangle (i.e. it uses <a href="qlistviewitem.html#height">QListViewItem::height</a>(), rather than
752<a href="qlistviewitem.html#totalHeight">QListViewItem::totalHeight</a>()). If you want the rectangle to
753include children you can use something like this:
754<p> <pre>
755 <a href="qrect.html">QRect</a> r( listView-&gt;itemRect( item ) );
756 r.<a href="qrect.html#setHeight">setHeight</a>( (QCOORD)(QMIN( item-&gt;totalHeight(),
757 listView-&gt;viewport-&gt;height() - r.<a href="qrect.html#y">y</a>() ) ) )
758 </pre>
759
760<p> Note the way it avoids too-high rectangles. totalHeight() can be
761much larger than the window system's coordinate system allows.
762<p> <a href="#itemRect">itemRect</a>() is comparatively slow. It's best to call it only for
763items that are probably on-screen.
764
765<h3 class=fn>void <a name="itemRenamed"></a>QListView::itemRenamed ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, int&nbsp;col, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )<tt> [signal]</tt>
766</h3>
767
768<p> This signal is emitted when <em>item</em> has been renamed to <em>text</em>,
769e.g. by in in-place renaming, in column <em>col</em>.
770<p> <p>See also <a href="qlistviewitem.html#setRenameEnabled">QListViewItem::setRenameEnabled</a>().
771
772<h3 class=fn>void <a name="itemRenamed-2"></a>QListView::itemRenamed ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, int&nbsp;col )<tt> [signal]</tt>
773</h3>
774
775<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
776<p> This signal is emitted when <em>item</em> has been renamed, e.g. by
777in-place renaming, in column <em>col</em>.
778<p> <p>See also <a href="qlistviewitem.html#setRenameEnabled">QListViewItem::setRenameEnabled</a>().
779
780<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a>&nbsp;* <a name="lastItem"></a>QListView::lastItem () const
781</h3>
782Returns the last item in the list view tree. Returns 0 if there
783are no items in the QListView.
784<p> This function is slow because it traverses the entire tree to find
785the last item.
786
787<h3 class=fn>void <a name="mouseButtonClicked"></a>QListView::mouseButtonClicked ( int&nbsp;button, <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, int&nbsp;c )<tt> [signal]</tt>
788</h3>
789
790<p> This signal is emitted whenever the user clicks (mouse pressed <em>and</em> mouse released) in the list view at position <em>pos</em>. <em>button</em>
791is the mouse button that the user pressed, <em>item</em> is the clicked
792list view item or 0 if the user didn't click on an item. If <em>item</em> is not 0, <em>c</em> is the list view column into which the user
793pressed; if <em>item</em> is 0 <em>c</em>'s value is undefined.
794<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
795connected to this signal.
796
797<h3 class=fn>void <a name="mouseButtonPressed"></a>QListView::mouseButtonPressed ( int&nbsp;button, <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos, int&nbsp;c )<tt> [signal]</tt>
798</h3>
799
800<p> This signal is emitted whenever the user pressed the mouse button
801in the list view at position <em>pos</em>. <em>button</em> is the mouse button
802which the user pressed, <em>item</em> is the pressed list view item or 0
803if the user didn't press on an item. If <em>item</em> is not 0, <em>c</em> is
804the list view column into which the user pressed; if <em>item</em> is 0
805<em>c</em>'s value is undefined.
806<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
807connected to this signal.
808
809<h3 class=fn>void <a name="onItem"></a>QListView::onItem ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;i )<tt> [signal]</tt>
810</h3>
811
812<p> This signal is emitted when the user moves the mouse cursor onto
813item <em>i</em>, similar to the <a href="qwidget.html#enterEvent">QWidget::enterEvent</a>() function.
814
815<h3 class=fn>void <a name="onViewport"></a>QListView::onViewport ()<tt> [signal]</tt>
816</h3>
817
818<p> This signal is emitted when the user moves the mouse cursor from
819an item to an empty part of the list view.
820
821<h3 class=fn>void <a name="paintEmptyArea"></a>QListView::paintEmptyArea ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;rect )<tt> [virtual protected]</tt>
822</h3>
823Paints <em>rect</em> so that it looks like empty background using
824painter <em>p</em>. <em>rect</em> is in widget coordinates, ready to be fed to
825<em>p</em>.
826<p> The default function fills <em>rect</em> with the
827<a href="qscrollview.html#viewport">viewport</a>()->backgroundBrush().
828
829<h3 class=fn>void <a name="pressed"></a>QListView::pressed ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
830</h3>
831
832<p> This signal is emitted whenever the user presses the mouse button
833in a list view. <em>item</em> is the list view item on which the user
834pressed the mouse button, or 0 if the user didn't press the mouse
835on an item.
836<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
837connected to this signal.
838
839<h3 class=fn>void <a name="pressed-2"></a>QListView::pressed ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pnt, int&nbsp;c )<tt> [signal]</tt>
840</h3>
841
842<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
843<p> This signal is emitted whenever the user presses the mouse button
844in a list view. <em>item</em> is the list view item on which the user
845pressed the mouse button, or 0 if the user didn't press the mouse
846on an item. <em>pnt</em> is the position of the mouse cursor in global
847coordinates, and <em>c</em> is the column where the mouse cursor was
848when the user pressed the mouse button.
849<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
850connected to this signal.
851
852<h3 class=fn>void <a name="removeColumn"></a>QListView::removeColumn ( int&nbsp;index )<tt> [virtual]</tt>
853</h3>
854Removes the column at position <em>index</em>.
855<p> If no columns remain after the column is removed, the
856list view will be cleared.
857<p> <p>See also <a href="#clear">clear</a>().
858
859<h3 class=fn>void <a name="removeItem"></a>QListView::removeItem ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item )<tt> [virtual]</tt>
860</h3>
861
862<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
863<p> This function has been renamed <a href="#takeItem">takeItem</a>().
864
865<h3 class=fn>void <a name="repaintItem"></a>QListView::repaintItem ( const&nbsp;<a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item ) const
866</h3>
867Repaints <em>item</em> on the screen if <em>item</em> is currently visible.
868Takes care to avoid multiple repaints.
869
870<h3 class=fn>void <a name="resizeEvent"></a>QListView::resizeEvent ( <a href="qresizeevent.html">QResizeEvent</a>&nbsp;*&nbsp;e )<tt> [virtual protected]</tt>
871</h3>
872Ensures that the header is correctly sized and positioned when the
873resize event <em>e</em> occurs.
874
875<h3 class=fn><a href="qlistview.html#ResizeMode-enum">ResizeMode</a> <a name="resizeMode"></a>QListView::resizeMode () const
876</h3><p>Returns TRUE if all, none or the only the last column should be resized; otherwise returns FALSE.
877See the <a href="qlistview.html#resizeMode-prop">"resizeMode"</a> property for details.
878<h3 class=fn>void <a name="returnPressed"></a>QListView::returnPressed ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;* )<tt> [signal]</tt>
879</h3>
880
881<p> This signal is emitted when Enter or Return is pressed. The
882argument is the <a href="#currentItem">currentItem</a>().
883
884<h3 class=fn>void <a name="rightButtonClicked"></a>QListView::rightButtonClicked ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;, int )<tt> [signal]</tt>
885</h3>
886
887<p> This signal is emitted when the right button is clicked (i.e. when
888it's released). The arguments are the relevant <a href="qlistviewitem.html">QListViewItem</a> (may
889be 0), the point in global coordinates and the relevant column (or
890-1 if the click was outside the list).
891
892<h3 class=fn>void <a name="rightButtonPressed"></a>QListView::rightButtonPressed ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;, int )<tt> [signal]</tt>
893</h3>
894
895<p> This signal is emitted when the right button is pressed. The
896arguments are the relevant <a href="qlistviewitem.html">QListViewItem</a> (may be 0), the point in
897global coordinates and the relevant column (or -1 if the click was
898outside the list).
899
900<h3 class=fn>bool <a name="rootIsDecorated"></a>QListView::rootIsDecorated () const
901</h3><p>Returns TRUE if the list view shows open/close signs on root items; otherwise returns FALSE.
902See the <a href="qlistview.html#rootIsDecorated-prop">"rootIsDecorated"</a> property for details.
903<h3 class=fn>void <a name="selectAll"></a>QListView::selectAll ( bool&nbsp;select )<tt> [virtual slot]</tt>
904</h3>
905If <em>select</em> is TRUE, all the items get selected; otherwise all
906the items get unselected. This only works in the selection modes <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a>. In <a href="#SelectionMode-enum">Single</a> and <a href="#SelectionMode-enum">NoSelection</a> mode the
907selection of the current item is just set to <em>select</em>.
908
909<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a>&nbsp;* <a name="selectedItem"></a>QListView::selectedItem () const
910</h3>
911Returns the selected item if the list view is in <a href="#SelectionMode-enum">Single</a>
912selection mode and an item is selected.
913<p> If no items are selected or the list view is not in <a href="#SelectionMode-enum">Single</a>
914selection mode this function returns 0.
915<p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="#multiSelection-prop">multiSelection</a>.
916
917<h3 class=fn>void <a name="selectionChanged"></a>QListView::selectionChanged ()<tt> [signal]</tt>
918</h3>
919
920<p> This signal is emitted whenever the set of selected items has
921changed (normally before the screen update). It is available in
922<a href="#SelectionMode-enum">Single</a>, <a href="#SelectionMode-enum">Multi</a>, and <a href="#SelectionMode-enum">Extended</a> selection modes, but is most
923useful in <a href="#SelectionMode-enum">Multi</a> selection mode.
924<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
925connected to this signal.
926<p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="qlistviewitem.html#setSelected">QListViewItem::setSelected</a>().
927
928<p>Example: <a href="listviews-example.html#x148">listviews/listviews.cpp</a>.
929<h3 class=fn>void <a name="selectionChanged-2"></a>QListView::selectionChanged ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;* )<tt> [signal]</tt>
930</h3>
931
932<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
933<p> This signal is emitted whenever the selected item has changed in
934<a href="#SelectionMode-enum">Single</a> selection mode (normally after the screen update). The
935argument is the newly selected item. If the selection is cleared
936(when, for example, the user clicks in the unused area of the list
937view) then this signal will not be emitted.
938<p> In <a href="#SelectionMode-enum">Multi</a> selection mode, use the no argument overload of this
939signal.
940<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots
941connected to this signal.
942<p> <p>See also <a href="#setSelected">setSelected</a>(), <a href="qlistviewitem.html#setSelected">QListViewItem::setSelected</a>(), and <a href="#currentChanged">currentChanged</a>().
943
944<h3 class=fn><a href="qlistview.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode"></a>QListView::selectionMode () const
945</h3><p>Returns the list view's selection mode.
946See the <a href="qlistview.html#selectionMode-prop">"selectionMode"</a> property for details.
947<h3 class=fn>void <a name="setAllColumnsShowFocus"></a>QListView::setAllColumnsShowFocus ( bool )<tt> [virtual]</tt>
948</h3><p>Sets whether items should show keyboard focus using all columns.
949See the <a href="qlistview.html#allColumnsShowFocus-prop">"allColumnsShowFocus"</a> property for details.
950<h3 class=fn>void <a name="setColumnAlignment"></a>QListView::setColumnAlignment ( int&nbsp;column, int&nbsp;align )<tt> [virtual]</tt>
951</h3>
952Sets column <em>column</em>'s alignment to <em>align</em>. The alignment is
953ultimately passed to <a href="qlistviewitem.html#paintCell">QListViewItem::paintCell</a>() for each item in
954the list view. For horizontally aligned text with Qt::AlignLeft or
955Qt::AlignHCenter the ellipsis (...) will be to the right, for
956Qt::AlignRight the ellipsis will be to the left.
957<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>.
958
959<p>Example: <a href="listviews-example.html#x150">listviews/listviews.cpp</a>.
960<h3 class=fn>void <a name="setColumnText"></a>QListView::setColumnText ( int&nbsp;column, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label )<tt> [virtual]</tt>
961</h3>
962Sets the heading of column <em>column</em> to <em>label</em>.
963<p> <p>See also <a href="#columnText">columnText</a>().
964
965<h3 class=fn>void <a name="setColumnText-2"></a>QListView::setColumnText ( int&nbsp;column, const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;iconset, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;label )<tt> [virtual]</tt>
966</h3>
967This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
968<p> Sets the heading of column <em>column</em> to <em>iconset</em> and <em>label</em>.
969<p> <p>See also <a href="#columnText">columnText</a>().
970
971<h3 class=fn>void <a name="setColumnWidth"></a>QListView::setColumnWidth ( int&nbsp;column, int&nbsp;w )<tt> [virtual]</tt>
972</h3>
973Sets the width of column <em>column</em> to <em>w</em> pixels. Note that if
974the column has a <a href="#WidthMode-enum">WidthMode</a> other than <a href="#WidthMode-enum">Manual</a>, this width
975setting may be subsequently overridden.
976<p> <p>See also <a href="#columnWidth">columnWidth</a>().
977
978<h3 class=fn>void <a name="setColumnWidthMode"></a>QListView::setColumnWidthMode ( int&nbsp;c, <a href="qlistview.html#WidthMode-enum">WidthMode</a>&nbsp;mode )<tt> [virtual]</tt>
979</h3>
980Sets column <em>c</em>'s width mode to <em>mode</em>. The default depends on
981the original width argument to <a href="#addColumn">addColumn</a>().
982<p> <p>See also <a href="qlistviewitem.html#width">QListViewItem::width</a>().
983
984<h3 class=fn>void <a name="setCurrentItem"></a>QListView::setCurrentItem ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;i )<tt> [virtual]</tt>
985</h3>
986Sets item <em>i</em> to be the current item and repaints appropriately
987(i.e. highlights the item). The current item is used for keyboard
988navigation and focus indication; it is independent of any selected
989items, although a selected item can also be the current item.
990<p> This function does not set the selection anchor. Use
991<a href="#setSelectionAnchor">setSelectionAnchor</a>() instead.
992<p> <p>See also <a href="#currentItem">currentItem</a>() and <a href="#setSelected">setSelected</a>().
993
994<p>Example: <a href="listviews-example.html#x151">listviews/listviews.cpp</a>.
995<h3 class=fn>void <a name="setDefaultRenameAction"></a>QListView::setDefaultRenameAction ( <a href="qlistview.html#RenameAction-enum">RenameAction</a>&nbsp;a )<tt> [virtual]</tt>
996</h3><p>Sets what action to perform when the editor loses focus during renaming to <em>a</em>.
997See the <a href="qlistview.html#defaultRenameAction-prop">"defaultRenameAction"</a> property for details.
998<h3 class=fn>void <a name="setItemMargin"></a>QListView::setItemMargin ( int )<tt> [virtual]</tt>
999</h3><p>Sets the advisory item margin that list items may use.
1000See the <a href="qlistview.html#itemMargin-prop">"itemMargin"</a> property for details.
1001<h3 class=fn>void <a name="setMultiSelection"></a>QListView::setMultiSelection ( bool&nbsp;enable )<tt> [virtual]</tt>
1002</h3><p>Sets whether the list view is in multi-selection or extended-selection mode to <em>enable</em>.
1003See the <a href="qlistview.html#multiSelection-prop">"multiSelection"</a> property for details.
1004<h3 class=fn>void <a name="setOpen"></a>QListView::setOpen ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, bool&nbsp;open )<tt> [virtual]</tt>
1005</h3>
1006Sets <em>item</em> to be open if <em>open</em> is TRUE and <em>item</em> is
1007expandable, and to be closed if <em>open</em> is FALSE. Repaints
1008accordingly.
1009<p> <p>See also <a href="qlistviewitem.html#setOpen">QListViewItem::setOpen</a>() and <a href="qlistviewitem.html#setExpandable">QListViewItem::setExpandable</a>().
1010
1011<h3 class=fn>void <a name="setResizeMode"></a>QListView::setResizeMode ( <a href="qlistview.html#ResizeMode-enum">ResizeMode</a>&nbsp;m )<tt> [virtual]</tt>
1012</h3><p>Sets whether all, none or the only the last column should be resized to <em>m</em>.
1013See the <a href="qlistview.html#resizeMode-prop">"resizeMode"</a> property for details.
1014<h3 class=fn>void <a name="setRootIsDecorated"></a>QListView::setRootIsDecorated ( bool )<tt> [virtual]</tt>
1015</h3><p>Sets whether the list view shows open/close signs on root items.
1016See the <a href="qlistview.html#rootIsDecorated-prop">"rootIsDecorated"</a> property for details.
1017<h3 class=fn>void <a name="setSelected"></a>QListView::setSelected ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item, bool&nbsp;selected )<tt> [virtual]</tt>
1018</h3>
1019If <em>selected</em> is TRUE the <em>item</em> is selected; otherwise it is
1020unselected.
1021<p> If the list view is in <a href="#SelectionMode-enum">Single</a> selection mode and <em>selected</em> is
1022TRUE, the currently selected item is unselected and <em>item</em> is
1023made current. Unlike <a href="qlistviewitem.html#setSelected">QListViewItem::setSelected</a>(), this function
1024updates the list view as necessary and emits the
1025<a href="#selectionChanged">selectionChanged</a>() signals.
1026<p> <p>See also <a href="#isSelected">isSelected</a>(), <a href="#multiSelection-prop">multiSelection</a>, <a href="#multiSelection-prop">multiSelection</a>, <a href="#setCurrentItem">setCurrentItem</a>(), and <a href="#setSelectionAnchor">setSelectionAnchor</a>().
1027
1028<p>Example: <a href="listviews-example.html#x153">listviews/listviews.cpp</a>.
1029<h3 class=fn>void <a name="setSelectionAnchor"></a>QListView::setSelectionAnchor ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;item )
1030</h3>
1031Sets the selection anchor to <em>item</em>, if <em>item</em> is selectable.
1032<p> The selection anchor is the item that remains selected when
1033Shift-selecting with either mouse or keyboard in <a href="#SelectionMode-enum">Extended</a>
1034selection mode.
1035<p> <p>See also <a href="#setSelected">setSelected</a>().
1036
1037<h3 class=fn>void <a name="setSelectionMode"></a>QListView::setSelectionMode ( <a href="qlistview.html#SelectionMode-enum">SelectionMode</a>&nbsp;mode )
1038</h3><p>Sets the list view's selection mode to <em>mode</em>.
1039See the <a href="qlistview.html#selectionMode-prop">"selectionMode"</a> property for details.
1040<h3 class=fn>void <a name="setShowSortIndicator"></a>QListView::setShowSortIndicator ( bool&nbsp;show )<tt> [virtual]</tt>
1041</h3><p>Sets whether the list view header should display a sort indicator to <em>show</em>.
1042See the <a href="qlistview.html#showSortIndicator-prop">"showSortIndicator"</a> property for details.
1043<h3 class=fn>void <a name="setShowToolTips"></a>QListView::setShowToolTips ( bool&nbsp;b )<tt> [virtual]</tt>
1044</h3><p>Sets whether this list view should show tooltips for truncated column texts to <em>b</em>.
1045See the <a href="qlistview.html#showToolTips-prop">"showToolTips"</a> property for details.
1046<h3 class=fn>void <a name="setSortColumn"></a>QListView::setSortColumn ( int&nbsp;column )
1047</h3>
1048Sets the sorting column for the list view.
1049<p> If <em>column</em> is -1, sorting is disabled and the user cannot sort
1050columns by clicking on the column headers. If <em>column</em> is larger
1051than the number of columns the user must click on a column header
1052to sort the list view.
1053<p> <p>See also <a href="#setSorting">setSorting</a>().
1054
1055<h3 class=fn>void <a name="setSortOrder"></a>QListView::setSortOrder ( <a href="qt.html#SortOrder-enum">SortOrder</a>&nbsp;order )
1056</h3>
1057Sets the sort order for the items in the list view to <em>order</em>.
1058<p> <p>See also <a href="#setSorting">setSorting</a>().
1059
1060<h3 class=fn>void <a name="setSorting"></a>QListView::setSorting ( int&nbsp;column, bool&nbsp;ascending = TRUE )<tt> [virtual]</tt>
1061</h3>
1062Sets the list view to be sorted by column <em>column</em> in ascending
1063order if <em>ascending</em> is TRUE or descending order if it is FALSE.
1064<p> If <em>column</em> is -1, sorting is disabled and the user cannot sort
1065columns by clicking on the column headers. If <em>column</em> is larger
1066than the number of columns the user must click on a column
1067header to sort the list view.
1068
1069<h3 class=fn>void <a name="setTreeStepSize"></a>QListView::setTreeStepSize ( int )<tt> [virtual]</tt>
1070</h3><p>Sets the number of pixels a child is offset from its parent.
1071See the <a href="qlistview.html#treeStepSize-prop">"treeStepSize"</a> property for details.
1072<h3 class=fn>bool <a name="showSortIndicator"></a>QListView::showSortIndicator () const
1073</h3><p>Returns TRUE if the list view header should display a sort indicator; otherwise returns FALSE.
1074See the <a href="qlistview.html#showSortIndicator-prop">"showSortIndicator"</a> property for details.
1075<h3 class=fn>bool <a name="showToolTips"></a>QListView::showToolTips () const
1076</h3><p>Returns TRUE if this list view should show tooltips for truncated column texts; otherwise returns FALSE.
1077See the <a href="qlistview.html#showToolTips-prop">"showToolTips"</a> property for details.
1078<h3 class=fn>void <a name="sort"></a>QListView::sort ()<tt> [virtual]</tt>
1079</h3>
1080Sorts the list view using the last sorting configuration (sort
1081column and ascending/descending).
1082
1083<h3 class=fn>int <a name="sortColumn"></a>QListView::sortColumn () const
1084</h3>
1085Returns the column by which the list view is sorted, or -1 if
1086sorting is disabled.
1087<p> <p>See also <a href="#sortOrder">sortOrder</a>().
1088
1089<h3 class=fn><a href="qt.html#SortOrder-enum">SortOrder</a> <a name="sortOrder"></a>QListView::sortOrder () const
1090</h3>
1091Returns the sorting order of the list view items.
1092<p> <p>See also <a href="#sortColumn">sortColumn</a>().
1093
1094<h3 class=fn>void <a name="spacePressed"></a>QListView::spacePressed ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;* )<tt> [signal]</tt>
1095</h3>
1096
1097<p> This signal is emitted when Space is pressed. The argument is
1098the <a href="#currentItem">currentItem</a>().
1099
1100<h3 class=fn>void <a name="startDrag"></a>QListView::startDrag ()<tt> [virtual protected]</tt>
1101</h3>
1102Starts a drag.
1103
1104<h3 class=fn>void <a name="takeItem"></a>QListView::takeItem ( <a href="qlistviewitem.html">QListViewItem</a>&nbsp;*&nbsp;i )<tt> [virtual]</tt>
1105</h3>
1106Removes item <em>i</em> from the list view; <em>i</em> must be a top-level
1107item. The warnings regarding <a href="qlistviewitem.html#takeItem">QListViewItem::takeItem</a>() apply to
1108this function, too.
1109<p> <p>See also <a href="#insertItem">insertItem</a>().
1110
1111<h3 class=fn>int <a name="treeStepSize"></a>QListView::treeStepSize () const
1112</h3><p>Returns the number of pixels a child is offset from its parent.
1113See the <a href="qlistview.html#treeStepSize-prop">"treeStepSize"</a> property for details.
1114<h3 class=fn>void <a name="triggerUpdate"></a>QListView::triggerUpdate ()<tt> [slot]</tt>
1115</h3>
1116Triggers a size, geometry and content update during the next
1117iteration of the event loop. Ensures that there'll be just one
1118update to avoid flicker.
1119
1120<h3 class=fn>void <a name="updateContents"></a>QListView::updateContents ()<tt> [protected slot]</tt>
1121</h3>
1122Updates the sizes of the viewport, header, scroll bars and so on.
1123<p> <b>Warning:</b> Don't call this directly; call <a href="#triggerUpdate">triggerUpdate</a>() instead.
1124
1125<hr><h2>Property Documentation</h2>
1126<h3 class=fn>bool <a name="allColumnsShowFocus-prop"></a>allColumnsShowFocus</h3>
1127<p>This property holds whether items should show <a href="focus.html#keyboard-focus">keyboard focus</a> using all columns.
1128<p>If this property is TRUE all columns will show focus and selection
1129states, otherwise only column 0 will show focus.
1130<p> The default is FALSE.
1131<p> Setting this to TRUE if it's not necessary may cause noticeable
1132flicker.
1133
1134<p>Set this property's value with <a href="#setAllColumnsShowFocus">setAllColumnsShowFocus</a>() and get this property's value with <a href="#allColumnsShowFocus">allColumnsShowFocus</a>().
1135<h3 class=fn>int <a name="childCount-prop"></a>childCount</h3>
1136<p>This property holds the number of parentless (top-level) <a href="qlistviewitem.html">QListViewItem</a> objects in this QListView.
1137<p>Holds the current number of parentless (top-level) QListViewItem
1138objects in this QListView.
1139<p> <p>See also <a href="qlistviewitem.html#childCount">QListViewItem::childCount</a>().
1140
1141<p>Get this property's value with <a href="#childCount">childCount</a>().
1142<h3 class=fn>int <a name="columns-prop"></a>columns</h3>
1143<p>This property holds the number of columns in this list view.
1144<p>Get this property's value with <a href="#columns">columns</a>().
1145<p><p>See also <a href="#addColumn">addColumn</a>() and <a href="#removeColumn">removeColumn</a>().
1146
1147<h3 class=fn><a href="qlistview.html#RenameAction-enum">RenameAction</a> <a name="defaultRenameAction-prop"></a>defaultRenameAction</h3>
1148<p>This property holds what action to perform when the editor loses focus during renaming.
1149<p>If this property is <a href="#RenameAction-enum">Accept</a>, and the user renames an item and
1150the editor loses focus (without the user pressing Enter), the
1151item will still be renamed. If the property's value is <a href="#RenameAction-enum">Reject</a>,
1152the item will not be renamed unless the user presses Enter. The
1153default is <a href="#RenameAction-enum">Reject</a>.
1154
1155<p>Set this property's value with <a href="#setDefaultRenameAction">setDefaultRenameAction</a>() and get this property's value with <a href="#defaultRenameAction">defaultRenameAction</a>().
1156<h3 class=fn>int <a name="itemMargin-prop"></a>itemMargin</h3>
1157<p>This property holds the advisory item margin that list items may use.
1158<p>The item margin defaults to one pixel and is the margin between
1159the item's edges and the area where it draws its contents.
1160<a href="qlistviewitem.html#paintFocus">QListViewItem::paintFocus</a>() draws in the margin.
1161<p> <p>See also <a href="qlistviewitem.html#paintCell">QListViewItem::paintCell</a>().
1162
1163<p>Set this property's value with <a href="#setItemMargin">setItemMargin</a>() and get this property's value with <a href="#itemMargin">itemMargin</a>().
1164<h3 class=fn>bool <a name="multiSelection-prop"></a>multiSelection</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1165<p> <p>This property holds whether the list view is in multi-selection or extended-selection mode.
1166<p>If you enable multi-selection, <a href="#SelectionMode-enum">Multi</a>, mode, it is possible to
1167specify whether or not this mode should be extended. <a href="#SelectionMode-enum">Extended</a>
1168means that the user can select multiple items only when pressing
1169the Shift or Ctrl key at the same time.
1170<p> The default selection mode is <a href="#SelectionMode-enum">Single</a>.
1171<p> <p>See also <a href="#selectionMode-prop">selectionMode</a>.
1172
1173<p>Set this property's value with <a href="#setMultiSelection">setMultiSelection</a>() and get this property's value with <a href="#isMultiSelection">isMultiSelection</a>().
1174<h3 class=fn><a href="qlistview.html#ResizeMode-enum">ResizeMode</a> <a name="resizeMode-prop"></a>resizeMode</h3>
1175<p>This property holds whether all, none or the only the last column should be resized.
1176<p>Specifies whether all, none or only the last column should be
1177resized to fit the full width of the list view. The values for this
1178property can be one of: <a href="#ResizeMode-enum">NoColumn</a> (the default), <a href="#ResizeMode-enum">AllColumns</a>
1179or <a href="#ResizeMode-enum">LastColumn</a>.
1180<p> <b>Warning:</b> Setting the resize mode should be done after all necessary
1181columns have been added to the list view, otherwise the behavior is
1182undefined.
1183<p> <p>See also <a href="qheader.html">QHeader</a> and <a href="#header">header</a>().
1184
1185<p>Set this property's value with <a href="#setResizeMode">setResizeMode</a>() and get this property's value with <a href="#resizeMode">resizeMode</a>().
1186<h3 class=fn>bool <a name="rootIsDecorated-prop"></a>rootIsDecorated</h3>
1187<p>This property holds whether the list view shows open/close signs on root items.
1188<p>Open/close signs are small <b>+</b> or <b>-</b> symbols in windows
1189style, or arrows in <a href="motif-extension.html#Motif">Motif</a> style. The default is FALSE.
1190
1191<p>Set this property's value with <a href="#setRootIsDecorated">setRootIsDecorated</a>() and get this property's value with <a href="#rootIsDecorated">rootIsDecorated</a>().
1192<h3 class=fn><a href="qlistview.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode-prop"></a>selectionMode</h3>
1193<p>This property holds the list view's selection mode.
1194<p>The mode can be <a href="#SelectionMode-enum">Single</a> (the default), <a href="#SelectionMode-enum">Extended</a>, <a href="#SelectionMode-enum">Multi</a> or
1195<a href="#SelectionMode-enum">NoSelection</a>.
1196<p> <p>See also <a href="#multiSelection-prop">multiSelection</a>.
1197
1198<p>Set this property's value with <a href="#setSelectionMode">setSelectionMode</a>() and get this property's value with <a href="#selectionMode">selectionMode</a>().
1199<h3 class=fn>bool <a name="showSortIndicator-prop"></a>showSortIndicator</h3>
1200<p>This property holds whether the list view header should display a sort indicator.
1201<p>If this property is TRUE, an arrow is drawn in the header of the
1202list view to indicate the sort order of the list view contents.
1203The arrow will be drawn in the correct column and will point up or
1204down, depending on the current sort direction. The default is
1205FALSE (don't show an indicator).
1206<p> <p>See also <a href="qheader.html#setSortIndicator">QHeader::setSortIndicator</a>().
1207
1208<p>Set this property's value with <a href="#setShowSortIndicator">setShowSortIndicator</a>() and get this property's value with <a href="#showSortIndicator">showSortIndicator</a>().
1209<h3 class=fn>bool <a name="showToolTips-prop"></a>showToolTips</h3>
1210<p>This property holds whether this list view should show tooltips for truncated column texts.
1211<p>The default is TRUE.
1212
1213<p>Set this property's value with <a href="#setShowToolTips">setShowToolTips</a>() and get this property's value with <a href="#showToolTips">showToolTips</a>().
1214<h3 class=fn>int <a name="treeStepSize-prop"></a>treeStepSize</h3>
1215<p>This property holds the number of pixels a child is offset from its parent.
1216<p>The default is 20 pixels.
1217<p> Of course, this property is only meaningful for hierarchical list
1218views.
1219
1220<p>Set this property's value with <a href="#setTreeStepSize">setTreeStepSize</a>() and get this property's value with <a href="#treeStepSize">treeStepSize</a>().
1221<!-- eof -->
1222<hr><p>
1223This file is part of the <a href="index.html">Qt toolkit</a>.
1224Copyright &copy; 1995-2007
1225<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
1226<table width=100% cellspacing=0 border=0><tr>
1227<td>Copyright &copy; 2007
1228<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
1229<td align=right><div align=right>Qt 3.3.8</div>
1230</table></div></address></body>
1231</html>
Note: See TracBrowser for help on using the repository browser.