1QListBox(3qt)                                                    QListBox(3qt)
2
3
4

NAME

6       QListBox - List of selectable, read-only items
7

SYNOPSIS

9       #include <qlistbox.h>
10
11       Inherits QScrollView.
12
13   Public Members
14       QListBox ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )
15       ~QListBox ()
16       uint count () const
17       void insertStringList ( const QStringList & list, int index = -1 )
18       void insertStrList ( const QStrList * list, int index = -1 )
19       void insertStrList ( const QStrList & list, int index = -1 )
20       void insertStrList ( const char ** strings, int numStrings = -1, int
21           index = -1 )
22       void insertItem ( const QListBoxItem * lbi, int index = -1 )
23       void insertItem ( const QListBoxItem * lbi, const QListBoxItem * after
24           )
25       void insertItem ( const QString & text, int index = -1 )
26       void insertItem ( const QPixmap & pixmap, int index = -1 )
27       void insertItem ( const QPixmap & pixmap, const QString & text, int
28           index = -1 )
29       void removeItem ( int index )
30       QString text ( int index ) const
31       const QPixmap * pixmap ( int index ) const
32       void changeItem ( const QListBoxItem * lbi, int index )
33       void changeItem ( const QString & text, int index )
34       void changeItem ( const QPixmap & pixmap, int index )
35       void changeItem ( const QPixmap & pixmap, const QString & text, int
36           index )
37       void takeItem ( const QListBoxItem * item )
38       int numItemsVisible () const
39       int currentItem () const
40       QString currentText () const
41       virtual void setCurrentItem ( int index )
42       virtual void setCurrentItem ( QListBoxItem * i )
43       void centerCurrentItem ()  (obsolete)
44       int topItem () const
45       virtual void setTopItem ( int index )
46       virtual void setBottomItem ( int index )
47       long maxItemWidth () const
48       enum SelectionMode { Single, Multi, Extended, NoSelection }
49       virtual void setSelectionMode ( SelectionMode )
50       SelectionMode selectionMode () const
51       void setMultiSelection ( bool multi )  (obsolete)
52       bool isMultiSelection () const  (obsolete)
53       virtual void setSelected ( QListBoxItem * item, bool select )
54       void setSelected ( int index, bool select )
55       bool isSelected ( int i ) const
56       bool isSelected ( const QListBoxItem * i ) const
57       QListBoxItem * selectedItem () const
58       QListBoxItem * item ( int index ) const
59       int index ( const QListBoxItem * lbi ) const
60       QListBoxItem * findItem ( const QString & text, ComparisonFlags compare
61           = BeginsWith ) const
62       void triggerUpdate ( bool doLayout )
63       bool itemVisible ( int index )
64       bool itemVisible ( const QListBoxItem * item )
65       enum LayoutMode { FixedNumber, FitToWidth, FitToHeight = FitToWidth,
66           Variable }
67       virtual void setColumnMode ( LayoutMode )
68       virtual void setColumnMode ( int )
69       virtual void setRowMode ( LayoutMode )
70       virtual void setRowMode ( int )
71       LayoutMode columnMode () const
72       LayoutMode rowMode () const
73       int numColumns () const
74       int numRows () const
75       bool variableWidth () const
76       virtual void setVariableWidth ( bool )
77       bool variableHeight () const
78       virtual void setVariableHeight ( bool )
79       bool autoScrollBar () const  (obsolete)
80       void setAutoScrollBar ( bool enable )  (obsolete)
81       bool scrollBar () const  (obsolete)
82       void setScrollBar ( bool enable )  (obsolete)
83       bool autoBottomScrollBar () const  (obsolete)
84       void setAutoBottomScrollBar ( bool enable )  (obsolete)
85       bool bottomScrollBar () const  (obsolete)
86       void setBottomScrollBar ( bool enable )  (obsolete)
87       int inSort ( const QListBoxItem * lbi )  (obsolete)
88       int inSort ( const QString & text )  (obsolete)
89       int cellHeight ( int i ) const  (obsolete)
90       int cellHeight () const  (obsolete)
91       int cellWidth () const  (obsolete)
92       int numCols () const  (obsolete)
93       int itemHeight ( int index = 0 ) const
94       QListBoxItem * itemAt ( const QPoint & p ) const
95       QRect itemRect ( QListBoxItem * item ) const
96       QListBoxItem * firstItem () const
97       void sort ( bool ascending = TRUE )
98
99   Public Slots
100       void clear ()
101       virtual void ensureCurrentVisible ()
102       virtual void clearSelection ()
103       virtual void selectAll ( bool select )
104       virtual void invertSelection ()
105
106   Signals
107       void highlighted ( int index )
108       void selected ( int index )
109       void highlighted ( const QString & )
110       void selected ( const QString & )
111       void highlighted ( QListBoxItem * )
112       void selected ( QListBoxItem * )
113       void selectionChanged ()
114       void selectionChanged ( QListBoxItem * item )
115       void currentChanged ( QListBoxItem * item )
116       void clicked ( QListBoxItem * item )
117       void clicked ( QListBoxItem * item, const QPoint & pnt )
118       void pressed ( QListBoxItem * item )
119       void pressed ( QListBoxItem * item, const QPoint & pnt )
120       void doubleClicked ( QListBoxItem * item )
121       void returnPressed ( QListBoxItem * )
122       void rightButtonClicked ( QListBoxItem *, const QPoint & )
123       void rightButtonPressed ( QListBoxItem *, const QPoint & )
124       void mouseButtonPressed ( int button, QListBoxItem * item, const QPoint
125           & pos )
126       void mouseButtonClicked ( int button, QListBoxItem * item, const QPoint
127           & pos )
128       void contextMenuRequested ( QListBoxItem * item, const QPoint & pos )
129       void onItem ( QListBoxItem * i )
130       void onViewport ()
131
132   Properties
133       LayoutMode columnMode - the column layout mode for this list box
134       uint count - the number of items in the list box  (read only)
135       int currentItem - the current highlighted item
136       QString currentText - the text of the current item  (read only)
137       bool multiSelection - whether or not the list box is in Multi selection
138           mode  (obsolete)
139       int numColumns - the number of columns in the list box  (read only)
140       int numItemsVisible - the number of visible items  (read only)
141       int numRows - the number of rows in the list box  (read only)
142       LayoutMode rowMode - the row layout mode for this list box
143       SelectionMode selectionMode - the selection mode of the list box
144       int topItem - the index of an item at the top of the screen
145       bool variableHeight - whether this list box has variable-height rows
146       bool variableWidth - whether this list box has variable-width columns
147
148   Protected Members
149       void updateItem ( int index )
150       void updateItem ( QListBoxItem * i )
151       int totalWidth () const  (obsolete)
152       int totalHeight () const  (obsolete)
153       virtual void paintCell ( QPainter * p, int row, int col )
154       void toggleCurrentItem ()
155       bool isRubberSelecting () const
156       void doLayout () const
157       bool itemYPos ( int index, int * yPos ) const  (obsolete)
158       int findItem ( int yPos ) const  (obsolete)
159

DESCRIPTION

161       The QListBox widget provides a list of selectable, read-only items.
162
163       This is typically a single-column list in which either no item or one
164       item is selected, but it can also be used in many other ways.
165
166       QListBox will add scroll bars as necessary, but it isn't intended for
167       really big lists. If you want more than a few thousand items, it's
168       probably better to use a different widget mainly because the scroll
169       bars won't provide very good navigation, but also because QListBox may
170       become slow with huge lists. (See QListView and QTable for possible
171       alternatives.)
172
173       There are a variety of selection modes described in the
174       QListBox::SelectionMode documentation. The default is Single selection
175       mode, but you can change it using setSelectionMode().
176       (setMultiSelection() is still provided for compatibility with Qt 1.x.
177       We recommend using setSelectionMode() in all code.)
178
179       Because QListBox offers multiple selection it must display keyboard
180       focus and selection state separately. Therefore there are functions
181       both to set the selection state of an item, i.e. setSelected(), and to
182       set which item displays keyboard focus, i.e. setCurrentItem().
183
184       The list box normally arranges its items in a single column and adds a
185       vertical scroll bar if required. It is possible to have a different
186       fixed number of columns (setColumnMode()), or as many columns as will
187       fit in the list box's assigned screen space
188       (setColumnMode(FitToWidth)), or to have a fixed number of rows
189       (setRowMode()) or as many rows as will fit in the list box's assigned
190       screen space (setRowMode(FitToHeight)). In all these cases QListBox
191       will add scroll bars, as appropriate, in at least one direction.
192
193       If multiple rows are used, each row can be as high as necessary (the
194       normal setting), or you can request that all items will have the same
195       height by calling setVariableHeight(FALSE). The same applies to a
196       column's width, see setVariableWidth().
197
198       The QListBox's items are QListBoxItem objects. QListBox provides
199       methods to insert new items as strings, as pixmaps, and as QListBoxItem
200       * (insertItem() with various arguments), and to replace an existing
201       item with a new string, pixmap or QListBoxItem (changeItem() with
202       various arguments). You can also remove items singly with removeItem()
203       or clear() the entire list box. Note that if you create a QListBoxItem
204       yourself and insert it, QListBox takes ownership of the item.
205
206       You can also create a QListBoxItem, such as QListBoxText or
207       QListBoxPixmap, with the list box as first parameter. The item will
208       then append itself. When you delete an item it is automatically removed
209       from the list box.
210
211       The list of items can be arbitrarily large; QListBox will add scroll
212       bars if necessary. QListBox can display a single-column (the common
213       case) or multiple-columns, and offers both single and multiple
214       selection. QListBox does not support multiple-column items (but
215       QListView and QTable do), or tree hierarchies (but QListView does).
216
217       The list box items can be accessed both as QListBoxItem objects
218       (recommended) and using integer indexes (the original QListBox
219       implementation used an array of strings internally, and the API still
220       supports this mode of operation). Everything can be done using the new
221       objects, and most things can be done using indexes.
222
223       Each item in a QListBox contains a QListBoxItem. One of the items can
224       be the current item. The currentChanged() signal and the highlighted()
225       signal are emitted when a new item becomes current, e.g. because the
226       user clicks on it or QListBox::setCurrentItem() is called. The
227       selected() signal is emitted when the user double-clicks on an item or
228       presses Enter on the current item.
229
230       If the user does not select anything, no signals are emitted and
231       currentItem() returns -1.
232
233       A list box has WheelFocus as a default focusPolicy(), i.e. it can get
234       keyboard focus by tabbing, clicking and through the use of the mouse
235       wheel.
236
237       New items can be inserted using insertItem(), insertStrList() or
238       insertStringList(). inSort() is obsolete because this method is quite
239       inefficient. It's preferable to insert the items normally and call
240       sort() afterwards, or to insert a sorted QStringList().
241
242       By default, vertical and horizontal scroll bars are added and removed
243       as necessary. setHScrollBarMode() and setVScrollBarMode() can be used
244       to change this policy.
245
246       If you need to insert types other than strings and pixmaps, you must
247       define new classes which inherit QListBoxItem.
248
249       Warning: The list box assumes ownership of all list box items and will
250       delete them when it does not need them any more.
251
252                                   [Image Omitted]
253
254                                   [Image Omitted]
255
256       See also QListView, QComboBox, QButtonGroup, GUI Design Handbook: List
257       Box (two sections), and Advanced Widgets.
258
259   Member Type Documentation

QListBox::LayoutMode

261       This enum type is used to specify how QListBox lays out its rows and
262       columns.
263
264       QListBox::FixedNumber - There is a fixed number of rows (or columns).
265
266       QListBox::FitToWidth - There are as many columns as will fit on-screen.
267
268       QListBox::FitToHeight - There are as many rows as will fit on-screen.
269
270       QListBox::Variable - There are as many rows as are required by the
271       column mode. (Or as many columns as required by the row mode.)
272
273       Example: When you call setRowMode( FitToHeight ), columnMode()
274       automatically becomes Variable to accommodate the row mode you've set.
275

QListBox::SelectionMode

277       This enumerated type is used by QListBox to indicate how it reacts to
278       selection by the user.
279
280       QListBox::Single - When the user selects an item, any already-selected
281       item becomes unselected and the user cannot unselect the selected item.
282       This means that the user can never clear the selection, even though the
283       selection may be cleared by the application programmer using
284       QListBox::clearSelection().
285
286       QListBox::Multi - When the user selects an item the selection status of
287       that item is toggled and the other items are left alone. Also, multiple
288       items can be selected by dragging the mouse while the left mouse button
289       is kept pressed.
290
291       QListBox::Extended - When the user selects an item the selection is
292       cleared and the new item selected. However, if the user presses the
293       Ctrl key when clicking on an item, the clicked item gets toggled and
294       all other items are left untouched. And if the user presses the Shift
295       key while clicking on an item, all items between the current item and
296       the clicked item get selected or unselected, depending on the state of
297       the clicked item. Also, multiple items can be selected by dragging the
298       mouse while the left mouse button is kept pressed.
299
300       QListBox::NoSelection - Items cannot be selected.
301
302       In other words, Single is a real single-selection list box, Multi is a
303       real multi-selection list box, Extended is a list box in which users
304       can select multiple items but usually want to select either just one or
305       a range of contiguous items, and NoSelection is for a list box where
306       the user can look but not touch.
307

MEMBER FUNCTION DOCUMENTATION

QListBox::QListBox ( QWidget * parent = 0, const char * name = 0, WFlags f = 0

310       )
311       Constructs a new empty list box called name and with parent parent.
312
313       Performance is boosted by modifying the widget flags f so that only
314       part of the QListBoxItem children is redrawn. This may be unsuitable
315       for custom QListBoxItem classes, in which case WStaticContents and
316       WNoAutoErase should be cleared immediately after construction.
317
318       See also QWidget::clearWFlags() and Qt::WidgetFlags.
319

QListBox::~QListBox ()

321       Destroys the list box. Deletes all list box items.
322

bool QListBox::autoBottomScrollBar () const

324       This function is obsolete. It is provided to keep old source working.
325       We strongly advise against using it in new code.
326
327       Returns TRUE if hScrollBarMode() is Auto; otherwise returns FALSE.
328

bool QListBox::autoScrollBar () const

330       This function is obsolete. It is provided to keep old source working.
331       We strongly advise against using it in new code.
332
333       Returns TRUE if vScrollBarMode() is Auto; otherwise returns FALSE.
334

bool QListBox::bottomScrollBar () const

336       This function is obsolete. It is provided to keep old source working.
337       We strongly advise against using it in new code.
338
339       Returns FALSE if vScrollBarMode() is AlwaysOff; otherwise returns TRUE.
340

int QListBox::cellHeight ( int i ) const

342       This function is obsolete. It is provided to keep old source working.
343       We strongly advise against using it in new code.
344
345       Returns the item height of item i.
346
347       See also itemHeight().
348

int QListBox::cellHeight () const

350       This function is obsolete. It is provided to keep old source working.
351       We strongly advise against using it in new code.
352
353       This is an overloaded member function, provided for convenience. It
354       behaves essentially like the above function.
355
356       Returns the item height of the first item, item 0.
357
358       See also itemHeight().
359

int QListBox::cellWidth () const

361       This function is obsolete. It is provided to keep old source working.
362       We strongly advise against using it in new code.
363
364       Returns the maximum item width.
365
366       See also maxItemWidth().
367

void QListBox::centerCurrentItem ()

369       This function is obsolete. It is provided to keep old source working.
370       We strongly advise against using it in new code.
371
372       This function does exactly the same as ensureCurrentVisible()
373
374       See also QListBox::ensureCurrentVisible().
375

void QListBox::changeItem ( const QListBoxItem * lbi, int index )

377       Replaces the item at position index with lbi. If index is negative or
378       too large, changeItem() does nothing.
379
380       The item that has been changed will become selected.
381
382       See also insertItem() and removeItem().
383

void QListBox::changeItem ( const QString & text, int index )

385       This is an overloaded member function, provided for convenience. It
386       behaves essentially like the above function.
387
388       Replaces the item at position index with a new list box text item with
389       text text.
390
391       The operation is ignored if index is out of range.
392
393       See also insertItem() and removeItem().
394

void QListBox::changeItem ( const QPixmap & pixmap, int index )

396       This is an overloaded member function, provided for convenience. It
397       behaves essentially like the above function.
398
399       Replaces the item at position index with a new list box pixmap item
400       with pixmap pixmap.
401
402       The operation is ignored if index is out of range.
403
404       See also insertItem() and removeItem().
405

void QListBox::changeItem ( const QPixmap & pixmap, const QString & text, int

407       index )
408       This is an overloaded member function, provided for convenience. It
409       behaves essentially like the above function.
410
411       Replaces the item at position index with a new list box pixmap item
412       with pixmap pixmap and text text.
413
414       The operation is ignored if index is out of range.
415
416       See also insertItem() and removeItem().
417

void QListBox::clear () [slot]

419       Deletes all the items in the list.
420
421       See also removeItem().
422

void QListBox::clearSelection () [virtual slot]

424       Deselects all items, if possible.
425
426       Note that a Single selection list box will automatically select an item
427       if it has keyboard focus.
428
429       Example: listbox/listbox.cpp.
430

void QListBox::clicked ( QListBoxItem * item ) [signal]

432       This signal is emitted when the user clicks any mouse button. If item
433       is not 0, the cursor is on item. If item is 0, the mouse cursor isn't
434       on any item.
435
436       Note that you must not delete any QListBoxItem objects in slots
437       connected to this signal.
438

void QListBox::clicked ( QListBoxItem * item, const QPoint & pnt ) [signal]

440       This is an overloaded member function, provided for convenience. It
441       behaves essentially like the above function.
442
443       This signal is emitted when the user clicks any mouse button. If item
444       is not 0, the cursor is on item. If item is 0, the mouse cursor isn't
445       on any item.
446
447       pnt is the position of the mouse cursor in the global coordinate system
448       (QMouseEvent::globalPos()). (If the click's press and release differs
449       by a pixel or two, pnt is the position at release time.)
450
451       Note that you must not delete any QListBoxItem objects in slots
452       connected to this signal.
453

LayoutMode QListBox::columnMode () const

455       Returns the column layout mode for this list box. See the "columnMode"
456       property for details.
457

void QListBox::contextMenuRequested ( QListBoxItem * item, const QPoint & pos

459       ) [signal]
460       This signal is emitted when the user invokes a context menu with the
461       right mouse button or with special system keys, with item being the
462       item under the mouse cursor or the current item, respectively.
463
464       pos is the position for the context menu in the global coordinate
465       system.
466

uint QListBox::count () const

468       Returns the number of items in the list box. See the "count" property
469       for details.
470

void QListBox::currentChanged ( QListBoxItem * item ) [signal]

472       This signal is emitted when the user makes a new item the current item.
473       item is the new current list box item.
474
475       See also currentItem and currentItem.
476

int QListBox::currentItem () const

478       Returns the current highlighted item. See the "currentItem" property
479       for details.
480

QString QListBox::currentText () const

482       Returns the text of the current item. See the "currentText" property
483       for details.
484

void QListBox::doLayout () const [protected]

486       This function does the hard layout work. You should never need to call
487       it.
488

void QListBox::doubleClicked ( QListBoxItem * item ) [signal]

490       This signal is emitted whenever an item is double-clicked. It's emitted
491       on the second button press, not the second button release. If item is
492       not 0, the cursor is on item. If item is 0, the mouse cursor isn't on
493       any item.
494

void QListBox::ensureCurrentVisible () [virtual slot]

496       Ensures that the current item is visible.
497

QListBoxItem * QListBox::findItem ( const QString & text, ComparisonFlags

499       compare = BeginsWith ) const
500       Finds the first list box item that has the text text and returns it, or
501       returns 0 of no such item could be found. The search starts from the
502       current item if the current item exists, otherwise it starts from the
503       first list box item. If ComparisonFlags are specified in compare then
504       these flags are used, otherwise the default is a case-insensitive,
505       "begins with" search.
506
507       See also Qt::StringComparisonMode.
508

int QListBox::findItem ( int yPos ) const [protected]

510       This function is obsolete. It is provided to keep old source working.
511       We strongly advise against using it in new code.
512
513       Returns the index of the item a point (0, yPos).
514
515       See also index() and itemAt().
516

QListBoxItem * QListBox::firstItem () const

518       Returns the first item in this list box. If the list box is empty,
519       returns 0.
520

void QListBox::highlighted ( int index ) [signal]

522       This signal is emitted when the user makes a new item the current item.
523       index is the index of the new current item.
524
525       See also currentChanged(), selected(), currentItem, and
526       selectionChanged().
527

void QListBox::highlighted ( const QString & ) [signal]

529       This is an overloaded member function, provided for convenience. It
530       behaves essentially like the above function.
531
532       This signal is emitted when the user makes a new item the current item
533       and the item is (or has) a string. The argument is the text of the new
534       current item.
535
536       See also currentChanged(), selected(), currentItem, and
537       selectionChanged().
538

void QListBox::highlighted ( QListBoxItem * ) [signal]

540       This is an overloaded member function, provided for convenience. It
541       behaves essentially like the above function.
542
543       This signal is emitted when the user makes a new item the current item.
544       The argument is a pointer to the new current item.
545
546       See also currentChanged(), selected(), currentItem, and
547       selectionChanged().
548

int QListBox::inSort ( const QListBoxItem * lbi )

550       This function is obsolete. It is provided to keep old source working.
551       We strongly advise against using it in new code.
552
553       Using this method is quite inefficient. We suggest to use insertItem()
554       for inserting and sort() afterwards.
555
556       Inserts lbi at its sorted position in the list box and returns the
557       position.
558
559       All items must be inserted with inSort() to maintain the sorting order.
560       inSort() treats any pixmap (or user-defined type) as lexicographically
561       less than any string.
562
563       See also insertItem() and sort().
564

int QListBox::inSort ( const QString & text )

566       This function is obsolete. It is provided to keep old source working.
567       We strongly advise against using it in new code.
568
569       This is an overloaded member function, provided for convenience. It
570       behaves essentially like the above function.
571
572       Using this method is quite inefficient. We suggest to use insertItem()
573       for inserting and sort() afterwards.
574
575       Inserts a new item of text at its sorted position in the list box and
576       returns the position.
577
578       All items must be inserted with inSort() to maintain the sorting order.
579       inSort() treats any pixmap (or user-defined type) as lexicographically
580       less than any string.
581
582       See also insertItem() and sort().
583

int QListBox::index ( const QListBoxItem * lbi ) const

585       Returns the index of lbi, or -1 if the item is not in this list box or
586       lbi is 0.
587
588       See also item().
589

void QListBox::insertItem ( const QListBoxItem * lbi, int index = -1 )

591       Inserts the item lbi into the list at position index.
592
593       If index is negative or larger than the number of items in the list
594       box, lbi is inserted at the end of the list.
595
596       See also insertStrList().
597
598       Examples:
599

void QListBox::insertItem ( const QListBoxItem * lbi, const QListBoxItem *

601       after )
602       This is an overloaded member function, provided for convenience. It
603       behaves essentially like the above function.
604
605       Inserts the item lbi into the list after the item after, or at the
606       beginning if after is 0.
607
608       See also insertStrList().
609

void QListBox::insertItem ( const QString & text, int index = -1 )

611       This is an overloaded member function, provided for convenience. It
612       behaves essentially like the above function.
613
614       Inserts a new list box text item with the text text into the list at
615       position index.
616
617       If index is negative, text is inserted at the end of the list.
618
619       See also insertStrList().
620

void QListBox::insertItem ( const QPixmap & pixmap, int index = -1 )

622       This is an overloaded member function, provided for convenience. It
623       behaves essentially like the above function.
624
625       Inserts a new list box pixmap item with the pixmap pixmap into the list
626       at position index.
627
628       If index is negative, pixmap is inserted at the end of the list.
629
630       See also insertStrList().
631

void QListBox::insertItem ( const QPixmap & pixmap, const QString & text, int

633       index = -1 )
634       This is an overloaded member function, provided for convenience. It
635       behaves essentially like the above function.
636
637       Inserts a new list box pixmap item with the pixmap pixmap and the text
638       text into the list at position index.
639
640       If index is negative, pixmap is inserted at the end of the list.
641
642       See also insertStrList().
643

void QListBox::insertStrList ( const QStrList * list, int index = -1 )

645       Inserts the string list list into the list at position index.
646
647       If index is negative, list is inserted at the end of the list. If index
648       is too large, the operation is ignored.
649
650       Warning: This function uses const char * rather than QString, so we
651       recommend against using it. It is provided so that legacy code will
652       continue to work, and so that programs that certainly will not need to
653       handle code outside a single 8-bit locale can use it. See
654       insertStringList() which uses real QStrings.
655
656       Warning: This function is never significantly faster than a loop around
657       insertItem().
658
659       See also insertItem() and insertStringList().
660

void QListBox::insertStrList ( const QStrList & list, int index = -1 )

662       This is an overloaded member function, provided for convenience. It
663       behaves essentially like the above function.
664
665       Inserts the string list list into the list at position index.
666
667       If index is negative, list is inserted at the end of the list. If index
668       is too large, the operation is ignored.
669
670       Warning: This function uses const char * rather than QString, so we
671       recommend against using it. It is provided so that legacy code will
672       continue to work, and so that programs that certainly will not need to
673       handle code outside a single 8-bit locale can use it. See
674       insertStringList() which uses real QStrings.
675
676       Warning: This function is never significantly faster than a loop around
677       insertItem().
678
679       See also insertItem() and insertStringList().
680

void QListBox::insertStrList ( const char ** strings, int numStrings = -1, int

682       index = -1 )
683       This is an overloaded member function, provided for convenience. It
684       behaves essentially like the above function.
685
686       Inserts the numStrings strings of the array strings into the list at
687       position index.
688
689       If index is negative, insertStrList() inserts strings at the end of the
690       list. If index is too large, the operation is ignored.
691
692       Warning: This function uses const char * rather than QString, so we
693       recommend against using it. It is provided so that legacy code will
694       continue to work, and so that programs that certainly will not need to
695       handle code outside a single 8-bit locale can use it. See
696       insertStringList() which uses real QStrings.
697
698       Warning: This function is never significantly faster than a loop around
699       insertItem().
700
701       See also insertItem() and insertStringList().
702

void QListBox::insertStringList ( const QStringList & list, int index = -1 )

704       Inserts the string list list into the list at position index.
705
706       If index is negative, list is inserted at the end of the list. If index
707       is too large, the operation is ignored.
708
709       Warning: This function is never significantly faster than a loop around
710       insertItem().
711
712       See also insertItem() and insertStrList().
713

void QListBox::invertSelection () [virtual slot]

715       Inverts the selection. Only works in Multi and Extended selection mode.
716

bool QListBox::isMultiSelection () const

718       Returns TRUE if or not the list box is in Multi selection mode;
719       otherwise returns FALSE. See the "multiSelection" property for details.
720

bool QListBox::isRubberSelecting () const [protected]

722       Returns TRUE if the user is selecting items using a rubber band
723       rectangle; otherwise returns FALSE.
724

bool QListBox::isSelected ( int i ) const

726       Returns TRUE if item i is selected; otherwise returns FALSE.
727

bool QListBox::isSelected ( const QListBoxItem * i ) const

729       This is an overloaded member function, provided for convenience. It
730       behaves essentially like the above function.
731
732       Returns TRUE if item i is selected; otherwise returns FALSE.
733

QListBoxItem * QListBox::item ( int index ) const

735       Returns a pointer to the item at position index, or 0 if index is out
736       of bounds.
737
738       See also index().
739
740       Example: listboxcombo/listboxcombo.cpp.
741

QListBoxItem * QListBox::itemAt ( const QPoint & p ) const

743       Returns the item at point p, specified in viewport coordinates, or a 0
744       if there is no item at p.
745
746       Use contentsToViewport() to convert between widget coordinates and
747       viewport coordinates.
748

int QListBox::itemHeight ( int index = 0 ) const

750       Returns the height in pixels of the item with index index. index
751       defaults to 0.
752
753       If index is too large, this function returns 0.
754

QRect QListBox::itemRect ( QListBoxItem * item ) const

756       Returns the rectangle on the screen that item occupies in viewport()'s
757       coordinates, or an invalid rectangle if item is 0 or is not currently
758       visible.
759

bool QListBox::itemVisible ( int index )

761       Returns TRUE if the item at position index is at least partly visible;
762       otherwise returns FALSE.
763

bool QListBox::itemVisible ( const QListBoxItem * item )

765       This is an overloaded member function, provided for convenience. It
766       behaves essentially like the above function.
767
768       Returns TRUE if item is at least partly visible; otherwise returns
769       FALSE.
770

bool QListBox::itemYPos ( int index, int * yPos ) const [protected]

772       This function is obsolete. It is provided to keep old source working.
773       We strongly advise against using it in new code.
774
775       Returns the vertical pixel-coordinate in *yPos, of the list box item at
776       position index in the list. Returns FALSE if the item is outside the
777       visible area.
778

long QListBox::maxItemWidth () const

780       Returns the width of the widest item in the list box.
781

void QListBox::mouseButtonClicked ( int button, QListBoxItem * item, const

783       QPoint & pos ) [signal]
784       This signal is emitted when the user clicks mouse button button. If
785       item is not 0, the cursor is on item. If item is 0, the mouse cursor
786       isn't on any item.
787
788       pos is the position of the mouse cursor in the global coordinate system
789       (QMouseEvent::globalPos()). (If the click's press and release differs
790       by a pixel or two, pos is the position at release time.)
791
792       Note that you must not delete any QListBoxItem objects in slots
793       connected to this signal.
794

void QListBox::mouseButtonPressed ( int button, QListBoxItem * item, const

796       QPoint & pos ) [signal]
797       This signal is emitted when the user presses mouse button button. If
798       item is not 0, the cursor is on item. If item is 0, the mouse cursor
799       isn't on any item.
800
801       pos is the position of the mouse cursor in the global coordinate system
802       (QMouseEvent::globalPos()).
803
804       Note that you must not delete any QListBoxItem objects in slots
805       connected to this signal.
806

int QListBox::numCols () const

808       This function is obsolete. It is provided to keep old source working.
809       We strongly advise against using it in new code.
810
811       Returns the number of columns.
812
813       See also numColumns.
814

int QListBox::numColumns () const

816       Returns the number of columns in the list box. See the "numColumns"
817       property for details.
818

int QListBox::numItemsVisible () const

820       Returns the number of visible items. See the "numItemsVisible" property
821       for details.
822

int QListBox::numRows () const

824       Returns the number of rows in the list box. See the "numRows" property
825       for details.
826

void QListBox::onItem ( QListBoxItem * i ) [signal]

828       This signal is emitted when the user moves the mouse cursor onto an
829       item, similar to the QWidget::enterEvent() function. i is the
830       QListBoxItem that the mouse has moved on.
831

void QListBox::onViewport () [signal]

833       This signal is emitted when the user moves the mouse cursor from an
834       item to an empty part of the list box.
835

void QListBox::paintCell ( QPainter * p, int row, int col ) [virtual

837       protected]
838       Provided for compatibility with the old QListBox. We recommend using
839       QListBoxItem::paint() instead.
840
841       Repaints the cell at row, col using painter p.
842

const QPixmap * QListBox::pixmap ( int index ) const

844       Returns a pointer to the pixmap at position index, or 0 if there is no
845       pixmap there.
846
847       See also text().
848

void QListBox::pressed ( QListBoxItem * item ) [signal]

850       This signal is emitted when the user presses any mouse button. If item
851       is not 0, the cursor is on item. If item is 0, the mouse cursor isn't
852       on any item.
853
854       Note that you must not delete any QListBoxItem objects in slots
855       connected to this signal.
856

void QListBox::pressed ( QListBoxItem * item, const QPoint & pnt ) [signal]

858       This is an overloaded member function, provided for convenience. It
859       behaves essentially like the above function.
860
861       This signal is emitted when the user presses any mouse button. If item
862       is not 0, the cursor is on item. If item is 0, the mouse cursor isn't
863       on any item.
864
865       pnt is the position of the mouse cursor in the global coordinate system
866       (QMouseEvent::globalPos()).
867
868       Note that you must not delete any QListBoxItem objects in slots
869       connected to this signal.
870
871       See also mouseButtonPressed(), rightButtonPressed(), and clicked().
872

void QListBox::removeItem ( int index )

874       Removes and deletes the item at position index. If index is equal to
875       currentItem(), a new item becomes current and the currentChanged() and
876       highlighted() signals are emitted.
877
878       See also insertItem() and clear().
879

void QListBox::returnPressed ( QListBoxItem * ) [signal]

881       This signal is emitted when Enter or Return is pressed. The argument is
882       currentItem().
883

void QListBox::rightButtonClicked ( QListBoxItem *, const QPoint & ) [signal]

885       This signal is emitted when the right button is clicked (i.e. when it's
886       released at the same point where it was pressed). The arguments are the
887       relevant QListBoxItem (may be 0) and the point in global coordinates.
888

void QListBox::rightButtonPressed ( QListBoxItem *, const QPoint & ) [signal]

890       This signal is emitted when the right button is pressed. The arguments
891       are the relevant QListBoxItem (may be 0) and the point in global
892       coordinates.
893

LayoutMode QListBox::rowMode () const

895       Returns the row layout mode for this list box. See the "rowMode"
896       property for details.
897

bool QListBox::scrollBar () const

899       This function is obsolete. It is provided to keep old source working.
900       We strongly advise against using it in new code.
901
902       Returns FALSE if vScrollBarMode() is AlwaysOff; otherwise returns TRUE.
903

void QListBox::selectAll ( bool select ) [virtual slot]

905       In Multi and Extended modes, this function sets all items to be
906       selected if select is TRUE, and to be unselected if select is FALSE.
907
908       In Single and NoSelection modes, this function only changes the
909       selection status of currentItem().
910

void QListBox::selected ( int index ) [signal]

912       This signal is emitted when the user double-clicks on an item or
913       presses Enter on the current item. index is the index of the selected
914       item.
915
916       See also currentChanged(), highlighted(), and selectionChanged().
917

void QListBox::selected ( const QString & ) [signal]

919       This is an overloaded member function, provided for convenience. It
920       behaves essentially like the above function.
921
922       This signal is emitted when the user double-clicks on an item or
923       presses Enter on the current item, and the item is (or has) a string.
924       The argument is the text of the selected item.
925
926       See also currentChanged(), highlighted(), and selectionChanged().
927

void QListBox::selected ( QListBoxItem * ) [signal]

929       This is an overloaded member function, provided for convenience. It
930       behaves essentially like the above function.
931
932       This signal is emitted when the user double-clicks on an item or
933       presses Enter on the current item. The argument is a pointer to the new
934       selected item.
935
936       See also currentChanged(), highlighted(), and selectionChanged().
937

QListBoxItem * QListBox::selectedItem () const

939       Returns the selected item if the list box is in single-selection mode
940       and an item is selected.
941
942       If no items are selected or the list box is in another selection mode
943       this function returns 0.
944
945       See also setSelected() and multiSelection.
946

void QListBox::selectionChanged () [signal]

948       This signal is emitted when the selection set of a list box changes.
949       This signal is emitted in each selection mode. If the user selects five
950       items by drag-selecting, QListBox tries to emit just one
951       selectionChanged() signal so the signal can be connected to
952       computationally expensive slots.
953
954       See also selected() and currentItem.
955

void QListBox::selectionChanged ( QListBoxItem * item ) [signal]

957       This is an overloaded member function, provided for convenience. It
958       behaves essentially like the above function.
959
960       This signal is emitted when the selection in a Single selection list
961       box changes. item is the newly selected list box item.
962
963       See also selected() and currentItem.
964

SelectionMode QListBox::selectionMode () const

966       Returns the selection mode of the list box. See the "selectionMode"
967       property for details.
968

void QListBox::setAutoBottomScrollBar ( bool enable )

970       This function is obsolete. It is provided to keep old source working.
971       We strongly advise against using it in new code.
972
973       If enable is TRUE sets setHScrollBarMode() to AlwaysOn; otherwise sets
974       setHScrollBarMode() to AlwaysOff.
975

void QListBox::setAutoScrollBar ( bool enable )

977       This function is obsolete. It is provided to keep old source working.
978       We strongly advise against using it in new code.
979
980       If enable is TRUE sets setVScrollBarMode() to AlwaysOn; otherwise sets
981       setVScrollBarMode() to AlwaysOff.
982

void QListBox::setBottomItem ( int index ) [virtual]

984       Scrolls the list box so the item at position index in the list is
985       displayed in the bottom row of the list box.
986
987       See also topItem.
988

void QListBox::setBottomScrollBar ( bool enable )

990       This function is obsolete. It is provided to keep old source working.
991       We strongly advise against using it in new code.
992
993       If enable is TRUE sets setHScrollBarMode() to AlwaysOn; otherwise sets
994       setHScrollBarMode() to AlwaysOff.
995

void QListBox::setColumnMode ( LayoutMode ) [virtual]

997       Sets the column layout mode for this list box. See the "columnMode"
998       property for details.
999

void QListBox::setColumnMode ( int ) [virtual]

1001       Sets the column layout mode for this list box. See the "columnMode"
1002       property for details.
1003

void QListBox::setCurrentItem ( int index ) [virtual]

1005       Sets the current highlighted item to index. See the "currentItem"
1006       property for details.
1007

void QListBox::setCurrentItem ( QListBoxItem * i ) [virtual]

1009       This is an overloaded member function, provided for convenience. It
1010       behaves essentially like the above function.
1011
1012       Sets the current item to the QListBoxItem i.
1013

void QListBox::setMultiSelection ( bool multi )

1015       Sets whether or not the list box is in Multi selection mode to multi.
1016       See the "multiSelection" property for details.
1017

void QListBox::setRowMode ( LayoutMode ) [virtual]

1019       Sets the row layout mode for this list box. See the "rowMode" property
1020       for details.
1021

void QListBox::setRowMode ( int ) [virtual]

1023       Sets the row layout mode for this list box. See the "rowMode" property
1024       for details.
1025

void QListBox::setScrollBar ( bool enable )

1027       This function is obsolete. It is provided to keep old source working.
1028       We strongly advise against using it in new code.
1029
1030       If enable is TRUE sets setVScrollBarMode() to AlwaysOn; otherwise sets
1031       setVScrollBarMode() to AlwaysOff.
1032

void QListBox::setSelected ( QListBoxItem * item, bool select ) [virtual]

1034       Selects item if select is TRUE or unselects it if select is FALSE, and
1035       repaints the item appropriately.
1036
1037       If the list box is a Single selection list box and select is TRUE,
1038       setSelected() calls setCurrentItem().
1039
1040       If the list box is a Single selection list box, select is FALSE,
1041       setSelected() calls clearSelection().
1042
1043       See also multiSelection, currentItem, clearSelection(), and
1044       currentItem.
1045

void QListBox::setSelected ( int index, bool select )

1047       This is an overloaded member function, provided for convenience. It
1048       behaves essentially like the above function.
1049
1050       If select is TRUE the item at position index is selected; otherwise the
1051       item is deselected.
1052

void QListBox::setSelectionMode ( SelectionMode ) [virtual]

1054       Sets the selection mode of the list box. See the "selectionMode"
1055       property for details.
1056

void QListBox::setTopItem ( int index ) [virtual]

1058       Sets the index of an item at the top of the screen to index. See the
1059       "topItem" property for details.
1060

void QListBox::setVariableHeight ( bool ) [virtual]

1062       Sets whether this list box has variable-height rows. See the
1063       "variableHeight" property for details.
1064

void QListBox::setVariableWidth ( bool ) [virtual]

1066       Sets whether this list box has variable-width columns. See the
1067       "variableWidth" property for details.
1068

void QListBox::sort ( bool ascending = TRUE )

1070       If ascending is TRUE sorts the items in ascending order; otherwise
1071       sorts in descending order.
1072
1073       To compare the items, the text (QListBoxItem::text()) of the items is
1074       used.
1075
1076       Example: listbox/listbox.cpp.
1077

void QListBox::takeItem ( const QListBoxItem * item )

1079       Removes item from the list box and causes an update of the screen
1080       display. The item is not deleted. You should normally not need to call
1081       this function because QListBoxItem::~QListBoxItem() calls it. The
1082       normal way to delete an item is with delete.
1083
1084       See also QListBox::insertItem().
1085

QString QListBox::text ( int index ) const

1087       Returns the text at position index, or QString::null if there is no
1088       text at that position.
1089
1090       See also pixmap().
1091

void QListBox::toggleCurrentItem () [protected]

1093       Toggles the selection status of currentItem() and repaints if the list
1094       box is a Multi selection list box.
1095
1096       See also multiSelection.
1097

int QListBox::topItem () const

1099       Returns the index of an item at the top of the screen. See the
1100       "topItem" property for details.
1101

int QListBox::totalHeight () const [protected]

1103       This function is obsolete. It is provided to keep old source working.
1104       We strongly advise against using it in new code.
1105
1106       Returns contentsHeight().
1107

int QListBox::totalWidth () const [protected]

1109       This function is obsolete. It is provided to keep old source working.
1110       We strongly advise against using it in new code.
1111
1112       Returns contentsWidth().
1113

void QListBox::triggerUpdate ( bool doLayout )

1115       Ensures that a single paint event will occur at the end of the current
1116       event loop iteration. If doLayout is TRUE, the layout is also redone.
1117

void QListBox::updateItem ( int index ) [protected]

1119       Repaints the item at position index in the list.
1120

void QListBox::updateItem ( QListBoxItem * i ) [protected]

1122       This is an overloaded member function, provided for convenience. It
1123       behaves essentially like the above function.
1124
1125       Repaints the QListBoxItem i.
1126

bool QListBox::variableHeight () const

1128       Returns TRUE if this list box has variable-height rows; otherwise
1129       returns FALSE. See the "variableHeight" property for details.
1130

bool QListBox::variableWidth () const

1132       Returns TRUE if this list box has variable-width columns; otherwise
1133       returns FALSE. See the "variableWidth" property for details.
1134
1135   Property Documentation

LayoutMode columnMode

1137       This property holds the column layout mode for this list box.
1138
1139       setColumnMode() sets the layout mode and adjusts the number of
1140       displayed columns. The row layout mode automatically becomes Variable,
1141       unless the column mode is Variable.
1142
1143       See also rowMode, rowMode, and numColumns.
1144
1145       Set this property's value with setColumnMode() and get this property's
1146       value with columnMode().
1147

uint count

1149       This property holds the number of items in the list box.
1150
1151       Get this property's value with count().
1152

int currentItem

1154       This property holds the current highlighted item.
1155
1156       When setting this property, the highlighting is moved to the item and
1157       the list box scrolled as necessary.
1158
1159       If no item is current, currentItem() returns -1.
1160
1161       Set this property's value with setCurrentItem() and get this property's
1162       value with currentItem().
1163

QString currentText

1165       This property holds the text of the current item.
1166
1167       This is equivalent to text(currentItem()).
1168
1169       Get this property's value with currentText().
1170

bool multiSelection

1172       This function is obsolete. It is provided to keep old source working.
1173       We strongly advise against using it in new code.
1174
1175       This property holds whether or not the list box is in Multi selection
1176       mode.
1177
1178       Consider using the QListBox::selectionMode property instead of this
1179       property.
1180
1181       When setting this property, Multi selection mode is used if set to TRUE
1182       and to Single selection mode if set to FALSE.
1183
1184       When getting this property, TRUE is returned if the list box is in
1185       Multi selection mode or Extended selection mode, and FALSE if it is in
1186       Single selection mode or NoSelection mode.
1187
1188       See also selectionMode.
1189
1190       Set this property's value with setMultiSelection() and get this
1191       property's value with isMultiSelection().
1192

int numColumns

1194       This property holds the number of columns in the list box.
1195
1196       This is normally 1, but can be different if QListBox::columnMode or
1197       QListBox::rowMode has been set.
1198
1199       See also columnMode, rowMode, and numRows.
1200
1201       Get this property's value with numColumns().
1202

int numItemsVisible

1204       This property holds the number of visible items.
1205
1206       Both partially and entirely visible items are counted.
1207
1208       Get this property's value with numItemsVisible().
1209

int numRows

1211       This property holds the number of rows in the list box.
1212
1213       This is equal to the number of items in the default single-column
1214       layout, but can be different.
1215
1216       See also columnMode, rowMode, and numColumns.
1217
1218       Get this property's value with numRows().
1219

LayoutMode rowMode

1221       This property holds the row layout mode for this list box.
1222
1223       This property is normally Variable.
1224
1225       setRowMode() sets the layout mode and adjusts the number of displayed
1226       rows. The column layout mode automatically becomes Variable, unless the
1227       row mode is Variable.
1228
1229       See also columnMode.
1230
1231       Set this property's value with setRowMode() and get this property's
1232       value with rowMode().
1233

SelectionMode selectionMode

1235       This property holds the selection mode of the list box.
1236
1237       Sets the list box's selection mode, which may be one of Single (the
1238       default), Extended, Multi or NoSelection.
1239
1240       See also SelectionMode.
1241
1242       Set this property's value with setSelectionMode() and get this
1243       property's value with selectionMode().
1244

int topItem

1246       This property holds the index of an item at the top of the screen.
1247
1248       When getting this property and the listbox has multiple columns, an
1249       arbitrary item is selected and returned.
1250
1251       When setting this property, the list box is scrolled so the item at
1252       position index in the list is displayed in the top row of the list box.
1253
1254       Set this property's value with setTopItem() and get this property's
1255       value with topItem().
1256

bool variableHeight

1258       This property holds whether this list box has variable-height rows.
1259
1260       When the list box has variable-height rows (the default), each row is
1261       as high as the highest item in that row. When it has same-sized rows,
1262       all rows are as high as the highest item in the list box.
1263
1264       See also variableWidth.
1265
1266       Set this property's value with setVariableHeight() and get this
1267       property's value with variableHeight().
1268

bool variableWidth

1270       This property holds whether this list box has variable-width columns.
1271
1272       When the list box has variable-width columns, each column is as wide as
1273       the widest item in that column. When it has same-sized columns (the
1274       default), all columns are as wide as the widest item in the list box.
1275
1276       See also variableHeight.
1277
1278       Set this property's value with setVariableWidth() and get this
1279       property's value with variableWidth().
1280
1281

SEE ALSO

1283       http://doc.trolltech.com/qlistbox.html
1284       http://www.trolltech.com/faq/tech.html
1285
1287       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
1288       license file included in the distribution for a complete license
1289       statement.
1290

AUTHOR

1292       Generated automatically from the source code.
1293

BUGS

1295       If you find a bug in Qt, please report it as described in
1296       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
1297       help you. Thank you.
1298
1299       The definitive Qt documentation is provided in HTML format; it is
1300       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
1301       web browser. This man page is provided as a convenience for those users
1302       who prefer man pages, although this format is not officially supported
1303       by Trolltech.
1304
1305       If you find errors in this manual page, please report them to qt-
1306       bugs@trolltech.com.  Please include the name of the manual page
1307       (qlistbox.3qt) and the Qt version (3.3.8).
1308
1309
1310
1311Trolltech AS                    2 February 2007                  QListBox(3qt)
Impressum