source: trunk/doc/html/qlistbox.html

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

reference documentation added

File size: 78.0 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/qlistbox.cpp:805 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QListBox 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>QListBox Class Reference</h1>
33
34<p>The QListBox widget provides a list of selectable, read-only items.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qlistbox-h.html">qlistbox.h</a>&gt;</tt>
37<p>Inherits <a href="qscrollview.html">QScrollView</a>.
38<p><a href="qlistbox-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QListBox"><b>QListBox</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="#~QListBox"><b>~QListBox</b></a> ()</li>
43<li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
44<li class=fn>void <a href="#insertStringList"><b>insertStringList</b></a> ( const&nbsp;QStringList&nbsp;&amp;&nbsp;list, int&nbsp;index = -1 )</li>
45<li class=fn>void <a href="#insertStrList"><b>insertStrList</b></a> ( const&nbsp;QStrList&nbsp;*&nbsp;list, int&nbsp;index = -1 )</li>
46<li class=fn>void <a href="#insertStrList-2"><b>insertStrList</b></a> ( const&nbsp;QStrList&nbsp;&amp;&nbsp;list, int&nbsp;index = -1 )</li>
47<li class=fn>void <a href="#insertStrList-3"><b>insertStrList</b></a> ( const&nbsp;char&nbsp;**&nbsp;strings, int&nbsp;numStrings = -1, int&nbsp;index = -1 )</li>
48<li class=fn>void <a href="#insertItem"><b>insertItem</b></a> ( const&nbsp;QListBoxItem&nbsp;*&nbsp;lbi, int&nbsp;index = -1 )</li>
49<li class=fn>void <a href="#insertItem-2"><b>insertItem</b></a> ( const&nbsp;QListBoxItem&nbsp;*&nbsp;lbi, const&nbsp;QListBoxItem&nbsp;*&nbsp;after )</li>
50<li class=fn>void <a href="#insertItem-3"><b>insertItem</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;index = -1 )</li>
51<li class=fn>void <a href="#insertItem-4"><b>insertItem</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, int&nbsp;index = -1 )</li>
52<li class=fn>void <a href="#insertItem-5"><b>insertItem</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;index = -1 )</li>
53<li class=fn>void <a href="#removeItem"><b>removeItem</b></a> ( int&nbsp;index )</li>
54<li class=fn>QString <a href="#text"><b>text</b></a> ( int&nbsp;index ) const</li>
55<li class=fn>const QPixmap * <a href="#pixmap"><b>pixmap</b></a> ( int&nbsp;index ) const</li>
56<li class=fn>void <a href="#changeItem"><b>changeItem</b></a> ( const&nbsp;QListBoxItem&nbsp;*&nbsp;lbi, int&nbsp;index )</li>
57<li class=fn>void <a href="#changeItem-2"><b>changeItem</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;index )</li>
58<li class=fn>void <a href="#changeItem-3"><b>changeItem</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, int&nbsp;index )</li>
59<li class=fn>void <a href="#changeItem-4"><b>changeItem</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, const&nbsp;QString&nbsp;&amp;&nbsp;text, int&nbsp;index )</li>
60<li class=fn>void <a href="#takeItem"><b>takeItem</b></a> ( const&nbsp;QListBoxItem&nbsp;*&nbsp;item )</li>
61<li class=fn>int <a href="#numItemsVisible"><b>numItemsVisible</b></a> () const</li>
62<li class=fn>int <a href="#currentItem"><b>currentItem</b></a> () const</li>
63<li class=fn>QString <a href="#currentText"><b>currentText</b></a> () const</li>
64<li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( int&nbsp;index )</li>
65<li class=fn>virtual void <a href="#setCurrentItem-2"><b>setCurrentItem</b></a> ( QListBoxItem&nbsp;*&nbsp;i )</li>
66<li class=fn>void centerCurrentItem () &nbsp;<em>(obsolete)</em></li>
67<li class=fn>int <a href="#topItem"><b>topItem</b></a> () const</li>
68<li class=fn>virtual void <a href="#setTopItem"><b>setTopItem</b></a> ( int&nbsp;index )</li>
69<li class=fn>virtual void <a href="#setBottomItem"><b>setBottomItem</b></a> ( int&nbsp;index )</li>
70<li class=fn>long <a href="#maxItemWidth"><b>maxItemWidth</b></a> () const</li>
71<li class=fn>enum <a href="#SelectionMode-enum"><b>SelectionMode</b></a> { Single, Multi, Extended, NoSelection }</li>
72<li class=fn>virtual void <a href="#setSelectionMode"><b>setSelectionMode</b></a> ( SelectionMode )</li>
73<li class=fn>SelectionMode <a href="#selectionMode"><b>selectionMode</b></a> () const</li>
74<li class=fn>void setMultiSelection ( bool&nbsp;multi ) &nbsp;<em>(obsolete)</em></li>
75<li class=fn>bool isMultiSelection () const &nbsp;<em>(obsolete)</em></li>
76<li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( QListBoxItem&nbsp;*&nbsp;item, bool&nbsp;select )</li>
77<li class=fn>void <a href="#setSelected-2"><b>setSelected</b></a> ( int&nbsp;index, bool&nbsp;select )</li>
78<li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> ( int&nbsp;i ) const</li>
79<li class=fn>bool <a href="#isSelected-2"><b>isSelected</b></a> ( const&nbsp;QListBoxItem&nbsp;*&nbsp;i ) const</li>
80<li class=fn>QListBoxItem * <a href="#selectedItem"><b>selectedItem</b></a> () const</li>
81<li class=fn>QListBoxItem * <a href="#item"><b>item</b></a> ( int&nbsp;index ) const</li>
82<li class=fn>int <a href="#index"><b>index</b></a> ( const&nbsp;QListBoxItem&nbsp;*&nbsp;lbi ) const</li>
83<li class=fn>QListBoxItem * <a href="#findItem"><b>findItem</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, ComparisonFlags&nbsp;compare = BeginsWith ) const</li>
84<li class=fn>void <a href="#triggerUpdate"><b>triggerUpdate</b></a> ( bool&nbsp;doLayout )</li>
85<li class=fn>bool <a href="#itemVisible"><b>itemVisible</b></a> ( int&nbsp;index )</li>
86<li class=fn>bool <a href="#itemVisible-2"><b>itemVisible</b></a> ( const&nbsp;QListBoxItem&nbsp;*&nbsp;item )</li>
87<li class=fn>enum <a href="#LayoutMode-enum"><b>LayoutMode</b></a> { FixedNumber, FitToWidth, FitToHeight = FitToWidth, Variable }</li>
88<li class=fn>virtual void <a href="#setColumnMode"><b>setColumnMode</b></a> ( LayoutMode )</li>
89<li class=fn>virtual void <a href="#setColumnMode-2"><b>setColumnMode</b></a> ( int )</li>
90<li class=fn>virtual void <a href="#setRowMode"><b>setRowMode</b></a> ( LayoutMode )</li>
91<li class=fn>virtual void <a href="#setRowMode-2"><b>setRowMode</b></a> ( int )</li>
92<li class=fn>LayoutMode <a href="#columnMode"><b>columnMode</b></a> () const</li>
93<li class=fn>LayoutMode <a href="#rowMode"><b>rowMode</b></a> () const</li>
94<li class=fn>int <a href="#numColumns"><b>numColumns</b></a> () const</li>
95<li class=fn>int <a href="#numRows"><b>numRows</b></a> () const</li>
96<li class=fn>bool <a href="#variableWidth"><b>variableWidth</b></a> () const</li>
97<li class=fn>virtual void <a href="#setVariableWidth"><b>setVariableWidth</b></a> ( bool )</li>
98<li class=fn>bool <a href="#variableHeight"><b>variableHeight</b></a> () const</li>
99<li class=fn>virtual void <a href="#setVariableHeight"><b>setVariableHeight</b></a> ( bool )</li>
100<li class=fn>bool autoScrollBar () const &nbsp;<em>(obsolete)</em></li>
101<li class=fn>void setAutoScrollBar ( bool&nbsp;enable ) &nbsp;<em>(obsolete)</em></li>
102<li class=fn>bool scrollBar () const &nbsp;<em>(obsolete)</em></li>
103<li class=fn>void setScrollBar ( bool&nbsp;enable ) &nbsp;<em>(obsolete)</em></li>
104<li class=fn>bool autoBottomScrollBar () const &nbsp;<em>(obsolete)</em></li>
105<li class=fn>void setAutoBottomScrollBar ( bool&nbsp;enable ) &nbsp;<em>(obsolete)</em></li>
106<li class=fn>bool bottomScrollBar () const &nbsp;<em>(obsolete)</em></li>
107<li class=fn>void setBottomScrollBar ( bool&nbsp;enable ) &nbsp;<em>(obsolete)</em></li>
108<li class=fn>int inSort ( const&nbsp;QListBoxItem&nbsp;*&nbsp;lbi ) &nbsp;<em>(obsolete)</em></li>
109<li class=fn>int inSort ( const&nbsp;QString&nbsp;&amp;&nbsp;text ) &nbsp;<em>(obsolete)</em></li>
110<li class=fn>int cellHeight ( int&nbsp;i ) const &nbsp;<em>(obsolete)</em></li>
111<li class=fn>int cellHeight () const &nbsp;<em>(obsolete)</em></li>
112<li class=fn>int cellWidth () const &nbsp;<em>(obsolete)</em></li>
113<li class=fn>int numCols () const &nbsp;<em>(obsolete)</em></li>
114<li class=fn>int <a href="#itemHeight"><b>itemHeight</b></a> ( int&nbsp;index = 0 ) const</li>
115<li class=fn>QListBoxItem * <a href="#itemAt"><b>itemAt</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) const</li>
116<li class=fn>QRect <a href="#itemRect"><b>itemRect</b></a> ( QListBoxItem&nbsp;*&nbsp;item ) const</li>
117<li class=fn>QListBoxItem * <a href="#firstItem"><b>firstItem</b></a> () const</li>
118<li class=fn>void <a href="#sort"><b>sort</b></a> ( bool&nbsp;ascending = TRUE )</li>
119</ul>
120<h2>Public Slots</h2>
121<ul>
122<li class=fn>void <a href="#clear"><b>clear</b></a> ()</li>
123<li class=fn>virtual void <a href="#ensureCurrentVisible"><b>ensureCurrentVisible</b></a> ()</li>
124<li class=fn>virtual void <a href="#clearSelection"><b>clearSelection</b></a> ()</li>
125<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool&nbsp;select )</li>
126<li class=fn>virtual void <a href="#invertSelection"><b>invertSelection</b></a> ()</li>
127</ul>
128<h2>Signals</h2>
129<ul>
130<li class=fn>void <a href="#highlighted"><b>highlighted</b></a> ( int&nbsp;index )</li>
131<li class=fn>void <a href="#selected"><b>selected</b></a> ( int&nbsp;index )</li>
132<li class=fn>void <a href="#highlighted-2"><b>highlighted</b></a> ( const QString &amp; )</li>
133<li class=fn>void <a href="#selected-2"><b>selected</b></a> ( const QString &amp; )</li>
134<li class=fn>void <a href="#highlighted-3"><b>highlighted</b></a> ( QListBoxItem * )</li>
135<li class=fn>void <a href="#selected-3"><b>selected</b></a> ( QListBoxItem * )</li>
136<li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
137<li class=fn>void <a href="#selectionChanged-2"><b>selectionChanged</b></a> ( QListBoxItem&nbsp;*&nbsp;item )</li>
138<li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( QListBoxItem&nbsp;*&nbsp;item )</li>
139<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( QListBoxItem&nbsp;*&nbsp;item )</li>
140<li class=fn>void <a href="#clicked-2"><b>clicked</b></a> ( QListBoxItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pnt )</li>
141<li class=fn>void <a href="#pressed"><b>pressed</b></a> ( QListBoxItem&nbsp;*&nbsp;item )</li>
142<li class=fn>void <a href="#pressed-2"><b>pressed</b></a> ( QListBoxItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pnt )</li>
143<li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( QListBoxItem&nbsp;*&nbsp;item )</li>
144<li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ( QListBoxItem * )</li>
145<li class=fn>void <a href="#rightButtonClicked"><b>rightButtonClicked</b></a> ( QListBoxItem *, const QPoint &amp; )</li>
146<li class=fn>void <a href="#rightButtonPressed"><b>rightButtonPressed</b></a> ( QListBoxItem *, const QPoint &amp; )</li>
147<li class=fn>void <a href="#mouseButtonPressed"><b>mouseButtonPressed</b></a> ( int&nbsp;button, QListBoxItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos )</li>
148<li class=fn>void <a href="#mouseButtonClicked"><b>mouseButtonClicked</b></a> ( int&nbsp;button, QListBoxItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos )</li>
149<li class=fn>void <a href="#contextMenuRequested"><b>contextMenuRequested</b></a> ( QListBoxItem&nbsp;*&nbsp;item, const&nbsp;QPoint&nbsp;&amp;&nbsp;pos )</li>
150<li class=fn>void <a href="#onItem"><b>onItem</b></a> ( QListBoxItem&nbsp;*&nbsp;i )</li>
151<li class=fn>void <a href="#onViewport"><b>onViewport</b></a> ()</li>
152</ul>
153<h2>Properties</h2>
154<ul>
155<li class=fn>LayoutMode <a href="#columnMode-prop"><b>columnMode</b></a>&nbsp;- the column layout mode for this list box</li>
156<li class=fn>uint <a href="#count-prop"><b>count</b></a>&nbsp;- the number of items in the list box &nbsp;<em>(read only)</em></li>
157<li class=fn>int <a href="#currentItem-prop"><b>currentItem</b></a>&nbsp;- the current highlighted item</li>
158<li class=fn>QString <a href="#currentText-prop"><b>currentText</b></a>&nbsp;- the text of the current item &nbsp;<em>(read only)</em></li>
159<li class=fn>bool multiSelection&nbsp;- whether or not the list box is in Multi selection mode &nbsp;<em>(obsolete)</em></li>
160<li class=fn>int <a href="#numColumns-prop"><b>numColumns</b></a>&nbsp;- the number of columns in the list box &nbsp;<em>(read only)</em></li>
161<li class=fn>int <a href="#numItemsVisible-prop"><b>numItemsVisible</b></a>&nbsp;- the number of visible items &nbsp;<em>(read only)</em></li>
162<li class=fn>int <a href="#numRows-prop"><b>numRows</b></a>&nbsp;- the number of rows in the list box &nbsp;<em>(read only)</em></li>
163<li class=fn>LayoutMode <a href="#rowMode-prop"><b>rowMode</b></a>&nbsp;- the row layout mode for this list box</li>
164<li class=fn>SelectionMode <a href="#selectionMode-prop"><b>selectionMode</b></a>&nbsp;- the selection mode of the list box</li>
165<li class=fn>int <a href="#topItem-prop"><b>topItem</b></a>&nbsp;- the index of an item at the top of the screen</li>
166<li class=fn>bool <a href="#variableHeight-prop"><b>variableHeight</b></a>&nbsp;- whether this list box has variable-height rows</li>
167<li class=fn>bool <a href="#variableWidth-prop"><b>variableWidth</b></a>&nbsp;- whether this list box has variable-width columns</li>
168</ul>
169<h2>Protected Members</h2>
170<ul>
171<li class=fn>void <a href="#updateItem"><b>updateItem</b></a> ( int&nbsp;index )</li>
172<li class=fn>void <a href="#updateItem-2"><b>updateItem</b></a> ( QListBoxItem&nbsp;*&nbsp;i )</li>
173<li class=fn>int totalWidth () const &nbsp;<em>(obsolete)</em></li>
174<li class=fn>int totalHeight () const &nbsp;<em>(obsolete)</em></li>
175<li class=fn>virtual void <a href="#paintCell"><b>paintCell</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;row, int&nbsp;col )</li>
176<li class=fn>void <a href="#toggleCurrentItem"><b>toggleCurrentItem</b></a> ()</li>
177<li class=fn>bool <a href="#isRubberSelecting"><b>isRubberSelecting</b></a> () const</li>
178<li class=fn>void <a href="#doLayout"><b>doLayout</b></a> () const</li>
179<li class=fn>bool itemYPos ( int&nbsp;index, int&nbsp;*&nbsp;yPos ) const &nbsp;<em>(obsolete)</em></li>
180<li class=fn>int findItem ( int&nbsp;yPos ) const &nbsp;<em>(obsolete)</em></li>
181</ul>
182<hr><a name="details"></a><h2>Detailed Description</h2>
183
184
185The QListBox widget provides a list of selectable, read-only items.
186<p>
187
188<p> This is typically a single-column list in which either no item or
189one item is selected, but it can also be used in many other ways.
190<p> QListBox will add scroll bars as necessary, but it isn't intended
191for <em>really</em> big lists. If you want more than a few thousand
192items, it's probably better to use a different widget mainly
193because the scroll bars won't provide very good navigation, but
194also because QListBox may become slow with huge lists. (See
195<a href="qlistview.html">QListView</a> and <a href="qtable.html">QTable</a> for possible alternatives.)
196<p> There are a variety of selection modes described in the
197QListBox::SelectionMode documentation. The default is <a href="#SelectionMode-enum">Single</a>
198selection mode, but you can change it using <a href="#setSelectionMode">setSelectionMode</a>().
199(<a href="#setMultiSelection">setMultiSelection</a>() is still provided for compatibility with Qt
2001.x. We recommend using setSelectionMode() in all code.)
201<p> Because QListBox offers multiple selection it must display
202<a href="focus.html#keyboard-focus">keyboard focus</a> and selection state separately. Therefore there are
203functions both to set the selection state of an item, i.e.
204<a href="#setSelected">setSelected</a>(), and to set which item displays keyboard focus, i.e.
205<a href="#setCurrentItem">setCurrentItem</a>().
206<p> The list box normally arranges its items in a single column and
207adds a vertical scroll bar if required. It is possible to have a
208different fixed number of columns (<a href="#setColumnMode">setColumnMode</a>()), or as many
209columns as will fit in the list box's assigned screen space
210(setColumnMode(FitToWidth)), or to have a fixed number of rows
211(<a href="#setRowMode">setRowMode</a>()) or as many rows as will fit in the list box's
212assigned screen space (setRowMode(FitToHeight)). In all these
213cases QListBox will add scroll bars, as appropriate, in at least
214one direction.
215<p> If multiple rows are used, each row can be as high as necessary
216(the normal setting), or you can request that all items will have
217the same height by calling <a href="#setVariableHeight">setVariableHeight</a>(FALSE). The same
218applies to a column's width, see <a href="#setVariableWidth">setVariableWidth</a>().
219<p> The QListBox's items are <a href="qlistboxitem.html">QListBoxItem</a> objects. QListBox provides
220methods to insert new items as strings, as pixmaps, and as
221QListBoxItem * (<a href="#insertItem">insertItem</a>() with various arguments), and to
222replace an existing item with a new string, pixmap or QListBoxItem
223(<a href="#changeItem">changeItem</a>() with various arguments). You can also remove items
224singly with <a href="#removeItem">removeItem</a>() or <a href="#clear">clear</a>() the entire list box. Note that
225if you create a QListBoxItem yourself and insert it, QListBox
226takes ownership of the item.
227<p> You can also create a QListBoxItem, such as <a href="qlistboxtext.html">QListBoxText</a> or
228<a href="qlistboxpixmap.html">QListBoxPixmap</a>, with the list box as first parameter. The item
229will then append itself. When you delete an item it is
230automatically removed from the list box.
231<p> The list of items can be arbitrarily large; QListBox will add
232scroll bars if necessary. QListBox can display a single-column
233(the common case) or multiple-columns, and offers both single and
234multiple selection. QListBox does not support multiple-column
235items (but <a href="qlistview.html">QListView</a> and <a href="qtable.html">QTable</a> do), or tree hierarchies (but
236QListView does).
237<p> The list box items can be accessed both as <a href="qlistboxitem.html">QListBoxItem</a> objects
238(recommended) and using integer indexes (the original QListBox
239implementation used an array of strings internally, and the API
240still supports this mode of operation). Everything can be done
241using the new objects, and most things can be done using indexes.
242<p> Each item in a QListBox contains a QListBoxItem. One of the items
243can be the current item. The <a href="#currentChanged">currentChanged</a>() signal and the
244<a href="#highlighted">highlighted</a>() signal are emitted when a new item becomes current,
245e.g. because the user clicks on it or <a href="#setCurrentItem">QListBox::setCurrentItem</a>()
246is called. The <a href="#selected">selected</a>() signal is emitted when the user
247double-clicks on an item or presses Enter on the current item.
248<p> If the user does not select anything, no signals are emitted and
249<a href="#currentItem">currentItem</a>() returns -1.
250<p> A list box has <a href="qwidget.html#FocusPolicy-enum">WheelFocus</a> as a default <a href="qwidget.html#focusPolicy">focusPolicy</a>(), i.e. it
251can get keyboard focus by tabbing, clicking and through the use of
252the mouse wheel.
253<p> New items can be inserted using <a href="#insertItem">insertItem</a>(), <a href="#insertStrList">insertStrList</a>() or
254<a href="#insertStringList">insertStringList</a>(). <a href="#inSort">inSort</a>() is obsolete because this method is
255quite inefficient. It's preferable to insert the items normally
256and call <a href="#sort">sort</a>() afterwards, or to insert a sorted <a href="qstringlist.html">QStringList</a>().
257<p> By default, vertical and horizontal scroll bars are added and
258removed as necessary. <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() and <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>()
259can be used to change this policy.
260<p> If you need to insert types other than strings and pixmaps, you
261must define new classes which inherit <a href="qlistboxitem.html">QListBoxItem</a>.
262<p> <b>Warning:</b> The list box assumes ownership of all list box items and
263will delete them when it does not need them any more.
264<p> <img src=qlistbox-m.png> <img src=qlistbox-w.png>
265<p> <p>See also <a href="qlistview.html">QListView</a>, <a href="qcombobox.html">QComboBox</a>, <a href="qbuttongroup.html">QButtonGroup</a>, <a href="guibooks.html#fowler">GUI Design Handbook: List Box (two
266 sections)</a>, and <a href="advanced.html">Advanced Widgets</a>.
267
268<hr><h2>Member Type Documentation</h2>
269<h3 class=fn><a name="LayoutMode-enum"></a>QListBox::LayoutMode</h3>
270
271<p> This enum type is used to specify how QListBox lays out its rows
272and columns.
273<ul>
274<li><tt>QListBox::FixedNumber</tt> - There is a fixed number of rows (or columns).
275<li><tt>QListBox::FitToWidth</tt> - There are as many columns as will fit
276on-screen.
277<li><tt>QListBox::FitToHeight</tt> - There are as many rows as will fit on-screen.
278<li><tt>QListBox::Variable</tt> - There are as many rows as are required by the
279column mode. (Or as many columns as required by the row mode.)
280</ul><p> Example: When you call <a href="#setRowMode">setRowMode</a>( FitToHeight ), <a href="#columnMode">columnMode</a>()
281automatically becomes <a href="#LayoutMode-enum">Variable</a> to accommodate the row mode
282you've set.
283
284<h3 class=fn><a name="SelectionMode-enum"></a>QListBox::SelectionMode</h3>
285
286<p> This enumerated type is used by QListBox to indicate how it reacts
287to selection by the user.
288<ul>
289<li><tt>QListBox::Single</tt> - When the user selects an item, any already-selected
290item becomes unselected and the user cannot unselect the selected
291item. This means that the user can never clear the selection, even
292though the selection may be cleared by the application programmer
293using <a href="#clearSelection">QListBox::clearSelection</a>().
294<li><tt>QListBox::Multi</tt> - When the user selects an item the selection status
295of that item is toggled and the other items are left alone. Also,
296multiple items can be selected by dragging the mouse while the
297left mouse button is kept pressed.
298<li><tt>QListBox::Extended</tt> - When the user selects an item the selection is
299cleared and the new item selected. However, if the user presses
300the Ctrl key when clicking on an item, the clicked item gets
301toggled and all other items are left untouched. And if the user
302presses the Shift key while clicking on an item, all items between
303the current item and the clicked item get selected or unselected,
304depending on the state of the clicked item. Also, multiple items
305can be selected by dragging the mouse while the left mouse button
306is kept pressed.
307<li><tt>QListBox::NoSelection</tt> - Items cannot be selected.
308</ul><p> In other words, <a href="#SelectionMode-enum">Single</a> is a real single-selection list box, <a href="#SelectionMode-enum">Multi</a> is a real multi-selection list box, <a href="#SelectionMode-enum">Extended</a> is a list
309box in which users can select multiple items but usually want to
310select either just one or a range of contiguous items, and <a href="#SelectionMode-enum">NoSelection</a> is for a list box where the user can look but not
311touch.
312
313<hr><h2>Member Function Documentation</h2>
314<h3 class=fn><a name="QListBox"></a>QListBox::QListBox ( <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0, WFlags&nbsp;f = 0 )
315</h3>
316Constructs a new empty list box called <em>name</em> and with parent <em>parent</em>.
317<p> Performance is boosted by modifying the widget flags <em>f</em> so that
318only part of the <a href="qlistboxitem.html">QListBoxItem</a> children is redrawn. This may be
319unsuitable for custom QListBoxItem classes, in which case <a href="qt.html#WidgetFlags-enum">WStaticContents</a> and <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a> should be cleared
320immediately after construction.
321<p> <p>See also <a href="qwidget.html#clearWFlags">QWidget::clearWFlags</a>() and <a href="qt.html#WidgetFlags-enum">Qt::WidgetFlags</a>.
322
323<h3 class=fn><a name="~QListBox"></a>QListBox::~QListBox ()
324</h3>
325Destroys the list box. Deletes all list box items.
326
327<h3 class=fn>bool <a name="autoBottomScrollBar"></a>QListBox::autoBottomScrollBar () const
328</h3>
329
330<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
331<p> Returns TRUE if <a href="qscrollview.html#hScrollBarMode">hScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">Auto</a>; otherwise returns
332FALSE.
333
334<h3 class=fn>bool <a name="autoScrollBar"></a>QListBox::autoScrollBar () const
335</h3>
336
337<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
338<p> Returns TRUE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">Auto</a>; otherwise returns
339FALSE.
340
341<h3 class=fn>bool <a name="bottomScrollBar"></a>QListBox::bottomScrollBar () const
342</h3>
343
344<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
345<p> Returns FALSE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>; otherwise
346returns TRUE.
347
348<h3 class=fn>int <a name="cellHeight"></a>QListBox::cellHeight ( int&nbsp;i ) const
349</h3>
350<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
351<p>
352Returns the item height of item <em>i</em>.
353<p>See also <a href="#itemHeight">itemHeight</a>().
354
355<h3 class=fn>int <a name="cellHeight-2"></a>QListBox::cellHeight () const
356</h3>
357<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
358<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
359<p> Returns the item height of the first item, item 0.
360<p>See also <a href="#itemHeight">itemHeight</a>().
361
362<h3 class=fn>int <a name="cellWidth"></a>QListBox::cellWidth () const
363</h3>
364<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
365<p>
366Returns the maximum item width.
367<p>See also <a href="#maxItemWidth">maxItemWidth</a>().
368
369<h3 class=fn>void <a name="centerCurrentItem"></a>QListBox::centerCurrentItem ()
370</h3>
371
372<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
373<p> This function does exactly the same as <a href="#ensureCurrentVisible">ensureCurrentVisible</a>()
374<p> <p>See also <a href="#ensureCurrentVisible">QListBox::ensureCurrentVisible</a>().
375
376<h3 class=fn>void <a name="changeItem"></a>QListBox::changeItem ( const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;lbi, int&nbsp;index )
377</h3>
378Replaces the item at position <em>index</em> with <em>lbi</em>. If <em>index</em> is
379negative or too large, <a href="#changeItem">changeItem</a>() does nothing.
380<p> The item that has been changed will become selected.
381<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
382
383<h3 class=fn>void <a name="changeItem-2"></a>QListBox::changeItem ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;index )
384</h3>
385This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
386<p> Replaces the item at position <em>index</em> with a new list box text
387item with text <em>text</em>.
388<p> The operation is ignored if <em>index</em> is out of range.
389<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
390
391<h3 class=fn>void <a name="changeItem-3"></a>QListBox::changeItem ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, int&nbsp;index )
392</h3>
393This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
394<p> Replaces the item at position <em>index</em> with a new list box pixmap
395item with pixmap <em>pixmap</em>.
396<p> The operation is ignored if <em>index</em> is out of range.
397<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
398
399<h3 class=fn>void <a name="changeItem-4"></a>QListBox::changeItem ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;index )
400</h3>
401This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
402<p> Replaces the item at position <em>index</em> with a new list box pixmap
403item with pixmap <em>pixmap</em> and text <em>text</em>.
404<p> The operation is ignored if <em>index</em> is out of range.
405<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#removeItem">removeItem</a>().
406
407<h3 class=fn>void <a name="clear"></a>QListBox::clear ()<tt> [slot]</tt>
408</h3>
409Deletes all the items in the list.
410<p> <p>See also <a href="#removeItem">removeItem</a>().
411
412<h3 class=fn>void <a name="clearSelection"></a>QListBox::clearSelection ()<tt> [virtual slot]</tt>
413</h3>
414Deselects all items, if possible.
415<p> Note that a <a href="#SelectionMode-enum">Single</a> selection list box will automatically select
416an item if it has <a href="focus.html#keyboard-focus">keyboard focus</a>.
417
418<p>Example: <a href="listbox-example.html#x1432">listbox/listbox.cpp</a>.
419<h3 class=fn>void <a name="clicked"></a>QListBox::clicked ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
420</h3>
421
422<p> This signal is emitted when the user clicks any mouse button. If
423<em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
424mouse cursor isn't on any item.
425<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
426connected to this signal.
427
428<h3 class=fn>void <a name="clicked-2"></a>QListBox::clicked ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pnt )<tt> [signal]</tt>
429</h3>
430This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
431<p> This signal is emitted when the user clicks any mouse button. If
432<em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
433mouse cursor isn't on any item.
434<p> <em>pnt</em> is the position of the mouse cursor in the global
435coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
436press and release differs by a pixel or two, <em>pnt</em> is the
437position at release time.)
438<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
439connected to this signal.
440
441<h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="columnMode"></a>QListBox::columnMode () const
442</h3><p>Returns the column layout mode for this list box.
443See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
444<h3 class=fn>void <a name="contextMenuRequested"></a>QListBox::contextMenuRequested ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos )<tt> [signal]</tt>
445</h3>
446
447<p> This signal is emitted when the user invokes a context menu with
448the right mouse button or with special system keys, with <em>item</em>
449being the item under the mouse cursor or the current item,
450respectively.
451<p> <em>pos</em> is the position for the context menu in the global
452coordinate system.
453
454<h3 class=fn>uint <a name="count"></a>QListBox::count () const
455</h3><p>Returns the number of items in the list box.
456See the <a href="qlistbox.html#count-prop">"count"</a> property for details.
457<h3 class=fn>void <a name="currentChanged"></a>QListBox::currentChanged ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
458</h3>
459
460<p> This signal is emitted when the user makes a new item the current
461item. <em>item</em> is the new current list box item.
462<p> <p>See also <a href="#currentItem-prop">currentItem</a> and <a href="#currentItem-prop">currentItem</a>.
463
464<h3 class=fn>int <a name="currentItem"></a>QListBox::currentItem () const
465</h3><p>Returns the current highlighted item.
466See the <a href="qlistbox.html#currentItem-prop">"currentItem"</a> property for details.
467<h3 class=fn><a href="qstring.html">QString</a> <a name="currentText"></a>QListBox::currentText () const
468</h3><p>Returns the text of the current item.
469See the <a href="qlistbox.html#currentText-prop">"currentText"</a> property for details.
470<h3 class=fn>void <a name="doLayout"></a>QListBox::doLayout () const<tt> [protected]</tt>
471</h3>
472This function does the hard layout work. You should never need to
473call it.
474
475<h3 class=fn>void <a name="doubleClicked"></a>QListBox::doubleClicked ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
476</h3>
477
478<p> This signal is emitted whenever an item is double-clicked. It's
479emitted on the second button press, not the second button release.
480If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0,
481the mouse cursor isn't on any item.
482
483<h3 class=fn>void <a name="ensureCurrentVisible"></a>QListBox::ensureCurrentVisible ()<tt> [virtual slot]</tt>
484</h3>
485Ensures that the current item is visible.
486
487<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a>&nbsp;* <a name="findItem"></a>QListBox::findItem ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, ComparisonFlags&nbsp;compare = BeginsWith ) const
488</h3>
489Finds the first list box item that has the text <em>text</em> and
490returns it, or returns 0 of no such item could be found.
491The search starts from the current item if the current item exists,
492otherwise it starts from the first list box item.
493If <tt>ComparisonFlags</tt> are specified in <em>compare</em> then these flags
494are used, otherwise the default is a case-insensitive, "begins
495with" search.
496<p> <p>See also <a href="qt.html#StringComparisonMode-enum">Qt::StringComparisonMode</a>.
497
498<h3 class=fn>int <a name="findItem-2"></a>QListBox::findItem ( int&nbsp;yPos ) const<tt> [protected]</tt>
499</h3>
500<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
501<p>
502Returns the index of the item a point (0, <em>yPos</em>).
503<p>See also <a href="#index">index</a>() and <a href="#itemAt">itemAt</a>().
504
505<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a>&nbsp;* <a name="firstItem"></a>QListBox::firstItem () const
506</h3>
507Returns the first item in this list box. If the list box is empty,
508returns 0.
509
510<h3 class=fn>void <a name="highlighted"></a>QListBox::highlighted ( int&nbsp;index )<tt> [signal]</tt>
511</h3>
512
513<p> This signal is emitted when the user makes a new item the current
514item. <em>index</em> is the index of the new current item.
515<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
516
517<h3 class=fn>void <a name="highlighted-2"></a>QListBox::highlighted ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
518</h3>
519This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
520<p> This signal is emitted when the user makes a new item the current
521item and the item is (or has) a string. The argument is the text
522of the new current item.
523<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
524
525<h3 class=fn>void <a name="highlighted-3"></a>QListBox::highlighted ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;* )<tt> [signal]</tt>
526</h3>
527This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
528<p> This signal is emitted when the user makes a new item the current
529item. The argument is a pointer to the new current item.
530<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#selected">selected</a>(), <a href="#currentItem-prop">currentItem</a>, and <a href="#selectionChanged">selectionChanged</a>().
531
532<h3 class=fn>int <a name="inSort"></a>QListBox::inSort ( const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;lbi )
533</h3>
534<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
535<p> Using this method is quite inefficient. We suggest to use <a href="#insertItem">insertItem</a>()
536for inserting and <a href="#sort">sort</a>() afterwards.
537<p> Inserts <em>lbi</em> at its sorted position in the list box and returns the
538position.
539<p> All items must be inserted with <a href="#inSort">inSort</a>() to maintain the sorting
540order. inSort() treats any pixmap (or user-defined type) as
541lexicographically less than any string.
542<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#sort">sort</a>().
543
544<h3 class=fn>int <a name="inSort-2"></a>QListBox::inSort ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )
545</h3>
546<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
547<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
548<p> Using this method is quite inefficient. We suggest to use <a href="#insertItem">insertItem</a>()
549for inserting and <a href="#sort">sort</a>() afterwards.
550<p> Inserts a new item of <em>text</em> at its sorted position in the list box and
551returns the position.
552<p> All items must be inserted with <a href="#inSort">inSort</a>() to maintain the sorting
553order. inSort() treats any pixmap (or user-defined type) as
554lexicographically less than any string.
555<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#sort">sort</a>().
556
557<h3 class=fn>int <a name="index"></a>QListBox::index ( const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;lbi ) const
558</h3>
559Returns the index of <em>lbi</em>, or -1 if the item is not in this list
560box or <em>lbi</em> is 0.
561<p> <p>See also <a href="#item">item</a>().
562
563<h3 class=fn>void <a name="insertItem"></a>QListBox::insertItem ( const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;lbi, int&nbsp;index = -1 )
564</h3>
565Inserts the item <em>lbi</em> into the list at position <em>index</em>.
566<p> If <em>index</em> is negative or larger than the number of items in the
567list box, <em>lbi</em> is inserted at the end of the list.
568<p> <p>See also <a href="#insertStrList">insertStrList</a>().
569
570<p>Examples: <a href="i18n-example.html#x1925">i18n/mywidget.cpp</a>, <a href="listbox-example.html#x1433">listbox/listbox.cpp</a>, <a href="listboxcombo-example.html#x1406">listboxcombo/listboxcombo.cpp</a>, and <a href="tabdialog-example.html#x55">tabdialog/tabdialog.cpp</a>.
571<h3 class=fn>void <a name="insertItem-2"></a>QListBox::insertItem ( const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;lbi, const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;after )
572</h3>
573This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
574<p> Inserts the item <em>lbi</em> into the list after the item <em>after</em>, or
575at the beginning if <em>after</em> is 0.
576<p> <p>See also <a href="#insertStrList">insertStrList</a>().
577
578<h3 class=fn>void <a name="insertItem-3"></a>QListBox::insertItem ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;index = -1 )
579</h3>
580This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
581<p> Inserts a new list box text item with the text <em>text</em> into the
582list at position <em>index</em>.
583<p> If <em>index</em> is negative, <em>text</em> is inserted at the end of the
584list.
585<p> <p>See also <a href="#insertStrList">insertStrList</a>().
586
587<h3 class=fn>void <a name="insertItem-4"></a>QListBox::insertItem ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, int&nbsp;index = -1 )
588</h3>
589This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
590<p> Inserts a new list box pixmap item with the pixmap <em>pixmap</em> into
591the list at position <em>index</em>.
592<p> If <em>index</em> is negative, <em>pixmap</em> is inserted at the end of the
593list.
594<p> <p>See also <a href="#insertStrList">insertStrList</a>().
595
596<h3 class=fn>void <a name="insertItem-5"></a>QListBox::insertItem ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, int&nbsp;index = -1 )
597</h3>
598This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
599<p> Inserts a new list box pixmap item with the pixmap <em>pixmap</em> and
600the text <em>text</em> into the list at position <em>index</em>.
601<p> If <em>index</em> is negative, <em>pixmap</em> is inserted at the end of the
602list.
603<p> <p>See also <a href="#insertStrList">insertStrList</a>().
604
605<h3 class=fn>void <a name="insertStrList"></a>QListBox::insertStrList ( const&nbsp;<a href="qstrlist.html">QStrList</a>&nbsp;*&nbsp;list, int&nbsp;index = -1 )
606</h3>
607Inserts the string list <em>list</em> into the list at position <em>index</em>.
608<p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
609list. If <em>index</em> is too large, the operation is ignored.
610<p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
611so we recommend against using it. It is provided so that legacy
612code will continue to work, and so that programs that certainly
613will not need to handle code outside a single 8-bit locale can use
614it. See <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
615<p> <b>Warning:</b> This function is never significantly faster than a loop
616around <a href="#insertItem">insertItem</a>().
617<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
618
619<h3 class=fn>void <a name="insertStrList-2"></a>QListBox::insertStrList ( const&nbsp;<a href="qstrlist.html">QStrList</a>&nbsp;&amp;&nbsp;list, int&nbsp;index = -1 )
620</h3>
621This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
622<p> Inserts the string list <em>list</em> into the list at position <em>index</em>.
623<p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
624list. If <em>index</em> is too large, the operation is ignored.
625<p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
626so we recommend against using it. It is provided so that legacy
627code will continue to work, and so that programs that certainly
628will not need to handle code outside a single 8-bit locale can use
629it. See <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
630<p> <b>Warning:</b> This function is never significantly faster than a loop
631around <a href="#insertItem">insertItem</a>().
632<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
633
634<h3 class=fn>void <a name="insertStrList-3"></a>QListBox::insertStrList ( const&nbsp;char&nbsp;**&nbsp;strings, int&nbsp;numStrings = -1, int&nbsp;index = -1 )
635</h3>
636This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
637<p> Inserts the <em>numStrings</em> strings of the array <em>strings</em> into the
638list at position <em>index</em>.
639<p> If <em>index</em> is negative, <a href="#insertStrList">insertStrList</a>() inserts <em>strings</em> at the
640end of the list. If <em>index</em> is too large, the operation is
641ignored.
642<p> <b>Warning:</b> This function uses <tt>const char *</tt> rather than <a href="qstring.html">QString</a>,
643so we recommend against using it. It is provided so that legacy
644code will continue to work, and so that programs that certainly
645will not need to handle code outside a single 8-bit locale can use
646it. See <a href="#insertStringList">insertStringList</a>() which uses real QStrings.
647<p> <b>Warning:</b> This function is never significantly faster than a loop
648around <a href="#insertItem">insertItem</a>().
649<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStringList">insertStringList</a>().
650
651<h3 class=fn>void <a name="insertStringList"></a>QListBox::insertStringList ( const&nbsp;<a href="qstringlist.html">QStringList</a>&nbsp;&amp;&nbsp;list, int&nbsp;index = -1 )
652</h3>
653Inserts the string list <em>list</em> into the list at position <em>index</em>.
654<p> If <em>index</em> is negative, <em>list</em> is inserted at the end of the
655list. If <em>index</em> is too large, the operation is ignored.
656<p> <b>Warning:</b> This function is never significantly faster than a loop
657around <a href="#insertItem">insertItem</a>().
658<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#insertStrList">insertStrList</a>().
659
660<h3 class=fn>void <a name="invertSelection"></a>QListBox::invertSelection ()<tt> [virtual slot]</tt>
661</h3>
662Inverts the selection. Only works in <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a>
663selection mode.
664
665<h3 class=fn>bool <a name="isMultiSelection"></a>QListBox::isMultiSelection () const
666</h3><p>Returns TRUE if or not the list box is in Multi selection mode; otherwise returns FALSE.
667See the <a href="qlistbox.html#multiSelection-prop">"multiSelection"</a> property for details.
668<h3 class=fn>bool <a name="isRubberSelecting"></a>QListBox::isRubberSelecting () const<tt> [protected]</tt>
669</h3>
670Returns TRUE if the user is selecting items using a rubber band
671rectangle; otherwise returns FALSE.
672
673<h3 class=fn>bool <a name="isSelected"></a>QListBox::isSelected ( int&nbsp;i ) const
674</h3>
675Returns TRUE if item <em>i</em> is selected; otherwise returns FALSE.
676
677<h3 class=fn>bool <a name="isSelected-2"></a>QListBox::isSelected ( const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;i ) const
678</h3>
679This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
680<p> Returns TRUE if item <em>i</em> is selected; otherwise returns FALSE.
681
682<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a>&nbsp;* <a name="item"></a>QListBox::item ( int&nbsp;index ) const
683</h3>
684Returns a pointer to the item at position <em>index</em>, or 0 if <em>index</em> is out of bounds.
685<p> <p>See also <a href="#index">index</a>().
686
687<p>Example: <a href="listboxcombo-example.html#x1407">listboxcombo/listboxcombo.cpp</a>.
688<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a>&nbsp;* <a name="itemAt"></a>QListBox::itemAt ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p ) const
689</h3>
690Returns the item at point <em>p</em>, specified in viewport coordinates,
691or a 0 if there is no item at <em>p</em>.
692<p> Use <a href="qscrollview.html#contentsToViewport">contentsToViewport</a>() to convert between widget coordinates and
693viewport coordinates.
694
695<h3 class=fn>int <a name="itemHeight"></a>QListBox::itemHeight ( int&nbsp;index = 0 ) const
696</h3>
697Returns the height in pixels of the item with index <em>index</em>. <em>index</em> defaults to 0.
698<p> If <em>index</em> is too large, this function returns 0.
699
700<h3 class=fn><a href="qrect.html">QRect</a> <a name="itemRect"></a>QListBox::itemRect ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item ) const
701</h3>
702Returns the rectangle on the screen that <em>item</em> occupies in
703<a href="qscrollview.html#viewport">viewport</a>()'s coordinates, or an invalid rectangle if <em>item</em> is 0
704or is not currently visible.
705
706<h3 class=fn>bool <a name="itemVisible"></a>QListBox::itemVisible ( int&nbsp;index )
707</h3>
708Returns TRUE if the item at position <em>index</em> is at least partly
709visible; otherwise returns FALSE.
710
711<h3 class=fn>bool <a name="itemVisible-2"></a>QListBox::itemVisible ( const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item )
712</h3>
713This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
714<p> Returns TRUE if <em>item</em> is at least partly visible; otherwise
715returns FALSE.
716
717<h3 class=fn>bool <a name="itemYPos"></a>QListBox::itemYPos ( int&nbsp;index, int&nbsp;*&nbsp;yPos ) const<tt> [protected]</tt>
718</h3>
719<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
720<p> Returns the vertical pixel-coordinate in <em>*yPos</em>, of the list box
721item at position <em>index</em> in the list. Returns FALSE if the item is
722outside the visible area.
723
724<h3 class=fn>long <a name="maxItemWidth"></a>QListBox::maxItemWidth () const
725</h3>
726Returns the width of the widest item in the list box.
727
728<h3 class=fn>void <a name="mouseButtonClicked"></a>QListBox::mouseButtonClicked ( int&nbsp;button, <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos )<tt> [signal]</tt>
729</h3>
730
731<p> This signal is emitted when the user clicks mouse button <em>button</em>. If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em>
732is 0, the mouse cursor isn't on any item.
733<p> <em>pos</em> is the position of the mouse cursor in the global
734coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
735press and release differs by a pixel or two, <em>pos</em> is the
736position at release time.)
737<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
738connected to this signal.
739
740<h3 class=fn>void <a name="mouseButtonPressed"></a>QListBox::mouseButtonPressed ( int&nbsp;button, <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pos )<tt> [signal]</tt>
741</h3>
742
743<p> This signal is emitted when the user presses mouse button <em>button</em>. If <em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em>
744is 0, the mouse cursor isn't on any item.
745<p> <em>pos</em> is the position of the mouse cursor in the global
746coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()).
747<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
748connected to this signal.
749
750<h3 class=fn>int <a name="numCols"></a>QListBox::numCols () const
751</h3>
752<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
753<p>
754Returns the number of columns.
755<p>See also <a href="#numColumns-prop">numColumns</a>.
756
757<h3 class=fn>int <a name="numColumns"></a>QListBox::numColumns () const
758</h3><p>Returns the number of columns in the list box.
759See the <a href="qlistbox.html#numColumns-prop">"numColumns"</a> property for details.
760<h3 class=fn>int <a name="numItemsVisible"></a>QListBox::numItemsVisible () const
761</h3><p>Returns the number of visible items.
762See the <a href="qlistbox.html#numItemsVisible-prop">"numItemsVisible"</a> property for details.
763<h3 class=fn>int <a name="numRows"></a>QListBox::numRows () const
764</h3><p>Returns the number of rows in the list box.
765See the <a href="qlistbox.html#numRows-prop">"numRows"</a> property for details.
766<h3 class=fn>void <a name="onItem"></a>QListBox::onItem ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;i )<tt> [signal]</tt>
767</h3>
768
769<p> This signal is emitted when the user moves the mouse cursor onto
770an item, similar to the <a href="qwidget.html#enterEvent">QWidget::enterEvent</a>() function. <em>i</em> is
771the <a href="qlistboxitem.html">QListBoxItem</a> that the mouse has moved on.
772
773<h3 class=fn>void <a name="onViewport"></a>QListBox::onViewport ()<tt> [signal]</tt>
774</h3>
775
776<p> This signal is emitted when the user moves the mouse cursor from
777an item to an empty part of the list box.
778
779<h3 class=fn>void <a name="paintCell"></a>QListBox::paintCell ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, int&nbsp;row, int&nbsp;col )<tt> [virtual protected]</tt>
780</h3>
781Provided for compatibility with the old QListBox. We recommend
782using <a href="qlistboxitem.html#paint">QListBoxItem::paint</a>() instead.
783<p> Repaints the cell at <em>row</em>, <em>col</em> using painter <em>p</em>.
784
785<h3 class=fn>const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;* <a name="pixmap"></a>QListBox::pixmap ( int&nbsp;index ) const
786</h3>
787Returns a pointer to the pixmap at position <em>index</em>, or 0 if
788there is no pixmap there.
789<p> <p>See also <a href="#text">text</a>().
790
791<h3 class=fn>void <a name="pressed"></a>QListBox::pressed ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
792</h3>
793
794<p> This signal is emitted when the user presses any mouse button. If
795<em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
796mouse cursor isn't on any item.
797<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
798connected to this signal.
799
800<h3 class=fn>void <a name="pressed-2"></a>QListBox::pressed ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pnt )<tt> [signal]</tt>
801</h3>
802This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
803<p> This signal is emitted when the user presses any mouse button. If
804<em>item</em> is not 0, the cursor is on <em>item</em>. If <em>item</em> is 0, the
805mouse cursor isn't on any item.
806<p> <em>pnt</em> is the position of the mouse cursor in the global
807coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()).
808<p> Note that you must not delete any <a href="qlistboxitem.html">QListBoxItem</a> objects in slots
809connected to this signal.
810<p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonPressed">rightButtonPressed</a>(), and <a href="#clicked">clicked</a>().
811
812<h3 class=fn>void <a name="removeItem"></a>QListBox::removeItem ( int&nbsp;index )
813</h3>
814Removes and deletes the item at position <em>index</em>. If <em>index</em> is
815equal to <a href="#currentItem">currentItem</a>(), a new item becomes current and the
816<a href="#currentChanged">currentChanged</a>() and <a href="#highlighted">highlighted</a>() signals are emitted.
817<p> <p>See also <a href="#insertItem">insertItem</a>() and <a href="#clear">clear</a>().
818
819<h3 class=fn>void <a name="returnPressed"></a>QListBox::returnPressed ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;* )<tt> [signal]</tt>
820</h3>
821
822<p> This signal is emitted when Enter or Return is pressed. The
823argument is <a href="#currentItem">currentItem</a>().
824
825<h3 class=fn>void <a name="rightButtonClicked"></a>QListBox::rightButtonClicked ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; )<tt> [signal]</tt>
826</h3>
827
828<p> This signal is emitted when the right button is clicked (i.e. when
829it's released at the same point where it was pressed). The
830arguments are the relevant <a href="qlistboxitem.html">QListBoxItem</a> (may be 0) and the point
831in global coordinates.
832
833<h3 class=fn>void <a name="rightButtonPressed"></a>QListBox::rightButtonPressed ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*, const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp; )<tt> [signal]</tt>
834</h3>
835
836<p> This signal is emitted when the right button is pressed. The
837arguments are the relevant <a href="qlistboxitem.html">QListBoxItem</a> (may be 0) and the point
838in global coordinates.
839
840<h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="rowMode"></a>QListBox::rowMode () const
841</h3><p>Returns the row layout mode for this list box.
842See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
843<h3 class=fn>bool <a name="scrollBar"></a>QListBox::scrollBar () const
844</h3>
845
846<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
847<p> Returns FALSE if <a href="qscrollview.html#vScrollBarMode">vScrollBarMode</a>() is <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>; otherwise
848returns TRUE.
849
850<h3 class=fn>void <a name="selectAll"></a>QListBox::selectAll ( bool&nbsp;select )<tt> [virtual slot]</tt>
851</h3>
852In <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a> modes, this function sets all items to
853be selected if <em>select</em> is TRUE, and to be unselected if <em>select</em> is FALSE.
854<p> In <a href="#SelectionMode-enum">Single</a> and <a href="#SelectionMode-enum">NoSelection</a> modes, this function only changes
855the selection status of <a href="#currentItem">currentItem</a>().
856
857<h3 class=fn>void <a name="selected"></a>QListBox::selected ( int&nbsp;index )<tt> [signal]</tt>
858</h3>
859
860<p> This signal is emitted when the user double-clicks on an item or
861presses Enter on the current item. <em>index</em> is the index of the
862selected item.
863<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
864
865<h3 class=fn>void <a name="selected-2"></a>QListBox::selected ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp; )<tt> [signal]</tt>
866</h3>
867This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
868<p> This signal is emitted when the user double-clicks on an item or
869presses Enter on the current item, and the item is (or has) a
870string. The argument is the text of the selected item.
871<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
872
873<h3 class=fn>void <a name="selected-3"></a>QListBox::selected ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;* )<tt> [signal]</tt>
874</h3>
875This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
876<p> This signal is emitted when the user double-clicks on an item or
877presses Enter on the current item. The argument is a pointer to
878the new selected item.
879<p> <p>See also <a href="#currentChanged">currentChanged</a>(), <a href="#highlighted">highlighted</a>(), and <a href="#selectionChanged">selectionChanged</a>().
880
881<h3 class=fn><a href="qlistboxitem.html">QListBoxItem</a>&nbsp;* <a name="selectedItem"></a>QListBox::selectedItem () const
882</h3> Returns the selected item if the list box is in
883single-selection mode and an item is selected.
884<p> If no items are selected or the list box is in another selection mode
885this function returns 0.
886<p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="#multiSelection-prop">multiSelection</a>.
887
888<h3 class=fn>void <a name="selectionChanged"></a>QListBox::selectionChanged ()<tt> [signal]</tt>
889</h3>
890
891<p> This signal is emitted when the selection set of a list box
892changes. This signal is emitted in each selection mode. If the
893user selects five items by drag-selecting, QListBox tries to emit
894just one <a href="#selectionChanged">selectionChanged</a>() signal so the signal can be connected
895to computationally expensive slots.
896<p> <p>See also <a href="#selected">selected</a>() and <a href="#currentItem-prop">currentItem</a>.
897
898<h3 class=fn>void <a name="selectionChanged-2"></a>QListBox::selectionChanged ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item )<tt> [signal]</tt>
899</h3>
900This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
901<p> This signal is emitted when the selection in a <a href="#SelectionMode-enum">Single</a> selection
902list box changes. <em>item</em> is the newly selected list box item.
903<p> <p>See also <a href="#selected">selected</a>() and <a href="#currentItem-prop">currentItem</a>.
904
905<h3 class=fn><a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode"></a>QListBox::selectionMode () const
906</h3><p>Returns the selection mode of the list box.
907See the <a href="qlistbox.html#selectionMode-prop">"selectionMode"</a> property for details.
908<h3 class=fn>void <a name="setAutoBottomScrollBar"></a>QListBox::setAutoBottomScrollBar ( bool&nbsp;enable )
909</h3>
910
911<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
912<p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
913otherwise sets setHScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
914
915<h3 class=fn>void <a name="setAutoScrollBar"></a>QListBox::setAutoScrollBar ( bool&nbsp;enable )
916</h3>
917
918<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
919<p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
920otherwise sets setVScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
921
922<h3 class=fn>void <a name="setBottomItem"></a>QListBox::setBottomItem ( int&nbsp;index )<tt> [virtual]</tt>
923</h3>
924Scrolls the list box so the item at position <em>index</em> in the list
925is displayed in the bottom row of the list box.
926<p> <p>See also <a href="#topItem-prop">topItem</a>.
927
928<h3 class=fn>void <a name="setBottomScrollBar"></a>QListBox::setBottomScrollBar ( bool&nbsp;enable )
929</h3>
930
931<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
932<p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setHScrollBarMode">setHScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
933otherwise sets setHScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
934
935<h3 class=fn>void <a name="setColumnMode"></a>QListBox::setColumnMode ( <a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> )<tt> [virtual]</tt>
936</h3><p>Sets the column layout mode for this list box.
937See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
938<h3 class=fn>void <a name="setColumnMode-2"></a>QListBox::setColumnMode ( int )<tt> [virtual]</tt>
939</h3><p>Sets the column layout mode for this list box.
940See the <a href="qlistbox.html#columnMode-prop">"columnMode"</a> property for details.
941<h3 class=fn>void <a name="setCurrentItem"></a>QListBox::setCurrentItem ( int&nbsp;index )<tt> [virtual]</tt>
942</h3><p>Sets the current highlighted item to <em>index</em>.
943See the <a href="qlistbox.html#currentItem-prop">"currentItem"</a> property for details.
944<h3 class=fn>void <a name="setCurrentItem-2"></a>QListBox::setCurrentItem ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;i )<tt> [virtual]</tt>
945</h3>
946This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
947<p> Sets the current item to the <a href="qlistboxitem.html">QListBoxItem</a> <em>i</em>.
948
949<h3 class=fn>void <a name="setMultiSelection"></a>QListBox::setMultiSelection ( bool&nbsp;multi )
950</h3><p>Sets whether or not the list box is in Multi selection mode to <em>multi</em>.
951See the <a href="qlistbox.html#multiSelection-prop">"multiSelection"</a> property for details.
952<h3 class=fn>void <a name="setRowMode"></a>QListBox::setRowMode ( <a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> )<tt> [virtual]</tt>
953</h3><p>Sets the row layout mode for this list box.
954See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
955<h3 class=fn>void <a name="setRowMode-2"></a>QListBox::setRowMode ( int )<tt> [virtual]</tt>
956</h3><p>Sets the row layout mode for this list box.
957See the <a href="qlistbox.html#rowMode-prop">"rowMode"</a> property for details.
958<h3 class=fn>void <a name="setScrollBar"></a>QListBox::setScrollBar ( bool&nbsp;enable )
959</h3>
960
961<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
962<p> If <em>enable</em> is TRUE sets <a href="qscrollview.html#setVScrollBarMode">setVScrollBarMode</a>() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOn</a>;
963otherwise sets setVScrollBarMode() to <a href="qscrollview.html#ScrollBarMode-enum">AlwaysOff</a>.
964
965<h3 class=fn>void <a name="setSelected"></a>QListBox::setSelected ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item, bool&nbsp;select )<tt> [virtual]</tt>
966</h3>
967Selects <em>item</em> if <em>select</em> is TRUE or unselects it if <em>select</em>
968is FALSE, and repaints the item appropriately.
969<p> If the list box is a <a href="#SelectionMode-enum">Single</a> selection list box and <em>select</em> is
970TRUE, <a href="#setSelected">setSelected</a>() calls <a href="#setCurrentItem">setCurrentItem</a>().
971<p> If the list box is a <a href="#SelectionMode-enum">Single</a> selection list box, <em>select</em> is
972FALSE, setSelected() calls <a href="#clearSelection">clearSelection</a>().
973<p> <p>See also <a href="#multiSelection-prop">multiSelection</a>, <a href="#currentItem-prop">currentItem</a>, <a href="#clearSelection">clearSelection</a>(), and <a href="#currentItem-prop">currentItem</a>.
974
975<h3 class=fn>void <a name="setSelected-2"></a>QListBox::setSelected ( int&nbsp;index, bool&nbsp;select )
976</h3>
977This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
978<p> If <em>select</em> is TRUE the item at position <em>index</em> is selected;
979otherwise the item is deselected.
980
981<h3 class=fn>void <a name="setSelectionMode"></a>QListBox::setSelectionMode ( <a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> )<tt> [virtual]</tt>
982</h3><p>Sets the selection mode of the list box.
983See the <a href="qlistbox.html#selectionMode-prop">"selectionMode"</a> property for details.
984<h3 class=fn>void <a name="setTopItem"></a>QListBox::setTopItem ( int&nbsp;index )<tt> [virtual]</tt>
985</h3><p>Sets the index of an item at the top of the screen to <em>index</em>.
986See the <a href="qlistbox.html#topItem-prop">"topItem"</a> property for details.
987<h3 class=fn>void <a name="setVariableHeight"></a>QListBox::setVariableHeight ( bool )<tt> [virtual]</tt>
988</h3><p>Sets whether this list box has variable-height rows.
989See the <a href="qlistbox.html#variableHeight-prop">"variableHeight"</a> property for details.
990<h3 class=fn>void <a name="setVariableWidth"></a>QListBox::setVariableWidth ( bool )<tt> [virtual]</tt>
991</h3><p>Sets whether this list box has variable-width columns.
992See the <a href="qlistbox.html#variableWidth-prop">"variableWidth"</a> property for details.
993<h3 class=fn>void <a name="sort"></a>QListBox::sort ( bool&nbsp;ascending = TRUE )
994</h3>
995If <em>ascending</em> is TRUE sorts the items in ascending order;
996otherwise sorts in descending order.
997<p> To compare the items, the text (<a href="qlistboxitem.html#text">QListBoxItem::text</a>()) of the items
998is used.
999
1000<p>Example: <a href="listbox-example.html#x1439">listbox/listbox.cpp</a>.
1001<h3 class=fn>void <a name="takeItem"></a>QListBox::takeItem ( const&nbsp;<a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;item )
1002</h3>
1003Removes <em>item</em> from the list box and causes an update of the
1004screen display. The item is not deleted. You should normally not
1005need to call this function because <a href="qlistboxitem.html#~QListBoxItem">QListBoxItem::~QListBoxItem</a>()
1006calls it. The normal way to delete an item is with <tt>delete</tt>.
1007<p> <p>See also <a href="#insertItem">QListBox::insertItem</a>().
1008
1009<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QListBox::text ( int&nbsp;index ) const
1010</h3>
1011Returns the text at position <em>index</em>, or <a href="qstring.html#QString-null">QString::null</a> if there
1012is no text at that position.
1013<p> <p>See also <a href="#pixmap">pixmap</a>().
1014
1015<h3 class=fn>void <a name="toggleCurrentItem"></a>QListBox::toggleCurrentItem ()<tt> [protected]</tt>
1016</h3>
1017Toggles the selection status of <a href="#currentItem">currentItem</a>() and repaints if the
1018list box is a <a href="#SelectionMode-enum">Multi</a> selection list box.
1019<p> <p>See also <a href="#multiSelection-prop">multiSelection</a>.
1020
1021<h3 class=fn>int <a name="topItem"></a>QListBox::topItem () const
1022</h3><p>Returns the index of an item at the top of the screen.
1023See the <a href="qlistbox.html#topItem-prop">"topItem"</a> property for details.
1024<h3 class=fn>int <a name="totalHeight"></a>QListBox::totalHeight () const<tt> [protected]</tt>
1025</h3>
1026<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1027<p>
1028Returns <a href="qscrollview.html#contentsHeight">contentsHeight</a>().
1029
1030<h3 class=fn>int <a name="totalWidth"></a>QListBox::totalWidth () const<tt> [protected]</tt>
1031</h3>
1032<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1033<p>
1034Returns <a href="qscrollview.html#contentsWidth">contentsWidth</a>().
1035
1036<h3 class=fn>void <a name="triggerUpdate"></a>QListBox::triggerUpdate ( bool&nbsp;doLayout )
1037</h3>
1038Ensures that a single paint event will occur at the end of the
1039current event loop iteration. If <em>doLayout</em> is TRUE, the layout
1040is also redone.
1041
1042<h3 class=fn>void <a name="updateItem"></a>QListBox::updateItem ( int&nbsp;index )<tt> [protected]</tt>
1043</h3>
1044Repaints the item at position <em>index</em> in the list.
1045
1046<h3 class=fn>void <a name="updateItem-2"></a>QListBox::updateItem ( <a href="qlistboxitem.html">QListBoxItem</a>&nbsp;*&nbsp;i )<tt> [protected]</tt>
1047</h3>
1048This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
1049<p> Repaints the <a href="qlistboxitem.html">QListBoxItem</a> <em>i</em>.
1050
1051<h3 class=fn>bool <a name="variableHeight"></a>QListBox::variableHeight () const
1052</h3><p>Returns TRUE if this list box has variable-height rows; otherwise returns FALSE.
1053See the <a href="qlistbox.html#variableHeight-prop">"variableHeight"</a> property for details.
1054<h3 class=fn>bool <a name="variableWidth"></a>QListBox::variableWidth () const
1055</h3><p>Returns TRUE if this list box has variable-width columns; otherwise returns FALSE.
1056See the <a href="qlistbox.html#variableWidth-prop">"variableWidth"</a> property for details.
1057<hr><h2>Property Documentation</h2>
1058<h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="columnMode-prop"></a>columnMode</h3>
1059<p>This property holds the column layout mode for this list box.
1060<p>setColumnMode() sets the layout mode and adjusts the number of
1061displayed columns. The row layout mode automatically becomes <a href="#LayoutMode-enum">Variable</a>, unless the column mode is <a href="#LayoutMode-enum">Variable</a>.
1062<p> <p>See also <a href="#rowMode-prop">rowMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numColumns-prop">numColumns</a>.
1063
1064<p>Set this property's value with <a href="#setColumnMode">setColumnMode</a>() and get this property's value with <a href="#columnMode">columnMode</a>().
1065<h3 class=fn>uint <a name="count-prop"></a>count</h3>
1066<p>This property holds the number of items in the list box.
1067<p>
1068<p>Get this property's value with <a href="#count">count</a>().
1069<h3 class=fn>int <a name="currentItem-prop"></a>currentItem</h3>
1070<p>This property holds the current highlighted item.
1071<p>When setting this property, the highlighting is moved to the item
1072and the list box scrolled as necessary.
1073<p> If no item is current, <a href="#currentItem">currentItem</a>() returns -1.
1074
1075<p>Set this property's value with <a href="#setCurrentItem">setCurrentItem</a>() and get this property's value with <a href="#currentItem">currentItem</a>().
1076<h3 class=fn><a href="qstring.html">QString</a> <a name="currentText-prop"></a>currentText</h3>
1077<p>This property holds the text of the current item.
1078<p>This is equivalent to <a href="#text">text</a>(currentItem()).
1079
1080<p>Get this property's value with <a href="#currentText">currentText</a>().
1081<h3 class=fn>bool <a name="multiSelection-prop"></a>multiSelection</h3>
1082<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
1083<p> <p>This property holds whether or not the list box is in Multi selection mode.
1084<p>Consider using the <a href="#selectionMode-prop">QListBox::selectionMode</a> property instead of
1085this property.
1086<p> When setting this property, Multi selection mode is used if set to TRUE and
1087to Single selection mode if set to FALSE.
1088<p> When getting this property, TRUE is returned if the list box is in
1089Multi selection mode or Extended selection mode, and FALSE if it is
1090in Single selection mode or NoSelection mode.
1091<p> <p>See also <a href="#selectionMode-prop">selectionMode</a>.
1092
1093<p>Set this property's value with <a href="#setMultiSelection">setMultiSelection</a>() and get this property's value with <a href="#isMultiSelection">isMultiSelection</a>().
1094<h3 class=fn>int <a name="numColumns-prop"></a>numColumns</h3>
1095<p>This property holds the number of columns in the list box.
1096<p>This is normally 1, but can be different if <a href="#columnMode-prop">QListBox::columnMode</a> or <a href="#rowMode-prop">QListBox::rowMode</a> has been set.
1097<p> <p>See also <a href="#columnMode-prop">columnMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numRows-prop">numRows</a>.
1098
1099<p>Get this property's value with <a href="#numColumns">numColumns</a>().
1100<h3 class=fn>int <a name="numItemsVisible-prop"></a>numItemsVisible</h3>
1101<p>This property holds the number of visible items.
1102<p>Both partially and entirely visible items are counted.
1103
1104<p>Get this property's value with <a href="#numItemsVisible">numItemsVisible</a>().
1105<h3 class=fn>int <a name="numRows-prop"></a>numRows</h3>
1106<p>This property holds the number of rows in the list box.
1107<p>This is equal to the number of items in the default single-column
1108layout, but can be different.
1109<p> <p>See also <a href="#columnMode-prop">columnMode</a>, <a href="#rowMode-prop">rowMode</a>, and <a href="#numColumns-prop">numColumns</a>.
1110
1111<p>Get this property's value with <a href="#numRows">numRows</a>().
1112<h3 class=fn><a href="qlistbox.html#LayoutMode-enum">LayoutMode</a> <a name="rowMode-prop"></a>rowMode</h3>
1113<p>This property holds the row layout mode for this list box.
1114<p>This property is normally <a href="#LayoutMode-enum">Variable</a>.
1115<p> <a href="#setRowMode">setRowMode</a>() sets the layout mode and adjusts the number of
1116displayed rows. The column layout mode automatically becomes <a href="#LayoutMode-enum">Variable</a>, unless the row mode is <a href="#LayoutMode-enum">Variable</a>.
1117<p> <p>See also <a href="#columnMode-prop">columnMode</a>.
1118
1119<p>Set this property's value with <a href="#setRowMode">setRowMode</a>() and get this property's value with <a href="#rowMode">rowMode</a>().
1120<h3 class=fn><a href="qlistbox.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode-prop"></a>selectionMode</h3>
1121<p>This property holds the selection mode of the list box.
1122<p>Sets the list box's selection mode, which may be one of <a href="#SelectionMode-enum">Single</a>
1123(the default), <a href="#SelectionMode-enum">Extended</a>, <a href="#SelectionMode-enum">Multi</a> or <a href="#SelectionMode-enum">NoSelection</a>.
1124<p> <p>See also <a href="#SelectionMode-enum">SelectionMode</a>.
1125
1126<p>Set this property's value with <a href="#setSelectionMode">setSelectionMode</a>() and get this property's value with <a href="#selectionMode">selectionMode</a>().
1127<h3 class=fn>int <a name="topItem-prop"></a>topItem</h3>
1128<p>This property holds the index of an item at the top of the screen.
1129<p>When getting this property and the listbox has multiple columns,
1130an arbitrary item is selected and returned.
1131<p> When setting this property, the list box is scrolled so the item
1132at position <em>index</em> in the list is displayed in the top row of
1133the list box.
1134
1135<p>Set this property's value with <a href="#setTopItem">setTopItem</a>() and get this property's value with <a href="#topItem">topItem</a>().
1136<h3 class=fn>bool <a name="variableHeight-prop"></a>variableHeight</h3>
1137<p>This property holds whether this list box has variable-height rows.
1138<p>When the list box has variable-height rows (the default), each row
1139is as high as the highest item in that row. When it has same-sized
1140rows, all rows are as high as the highest item in the list box.
1141<p> <p>See also <a href="#variableWidth-prop">variableWidth</a>.
1142
1143<p>Set this property's value with <a href="#setVariableHeight">setVariableHeight</a>() and get this property's value with <a href="#variableHeight">variableHeight</a>().
1144<h3 class=fn>bool <a name="variableWidth-prop"></a>variableWidth</h3>
1145<p>This property holds whether this list box has variable-width columns.
1146<p>When the list box has variable-width columns, each column is as
1147wide as the widest item in that column. When it has same-sized
1148columns (the default), all columns are as wide as the widest item
1149in the list box.
1150<p> <p>See also <a href="#variableHeight-prop">variableHeight</a>.
1151
1152<p>Set this property's value with <a href="#setVariableWidth">setVariableWidth</a>() and get this property's value with <a href="#variableWidth">variableWidth</a>().
1153<!-- eof -->
1154<hr><p>
1155This file is part of the <a href="index.html">Qt toolkit</a>.
1156Copyright &copy; 1995-2007
1157<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
1158<table width=100% cellspacing=0 border=0><tr>
1159<td>Copyright &copy; 2007
1160<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
1161<td align=right><div align=right>Qt 3.3.8</div>
1162</table></div></address></body>
1163</html>
Note: See TracBrowser for help on using the repository browser.