You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1111 lines
53 KiB
1111 lines
53 KiB
13 years ago
|
'\" t
|
||
|
.TH QListBox 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
|
||
|
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
|
||
|
.\" license file included in the distribution for a complete license
|
||
|
.\" statement.
|
||
|
.\"
|
||
|
.ad l
|
||
|
.nh
|
||
|
.SH NAME
|
||
|
QListBox \- List of selectable, read-only items
|
||
|
.SH SYNOPSIS
|
||
|
\fC#include <qlistbox.h>\fR
|
||
|
.PP
|
||
|
Inherits QScrollView.
|
||
|
.PP
|
||
|
.SS "Public Members"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "\fBQListBox\fR ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "\fB~QListBox\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "uint \fBcount\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertStringList\fR ( const QStringList & list, int index = -1 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertStrList\fR ( const QStrList * list, int index = -1 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertStrList\fR ( const QStrList & list, int index = -1 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertStrList\fR ( const char ** strings, int numStrings = -1, int index = -1 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertItem\fR ( const QListBoxItem * lbi, int index = -1 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertItem\fR ( const QListBoxItem * lbi, const QListBoxItem * after )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertItem\fR ( const QString & text, int index = -1 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertItem\fR ( const QPixmap & pixmap, int index = -1 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBinsertItem\fR ( const QPixmap & pixmap, const QString & text, int index = -1 )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBremoveItem\fR ( int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBtext\fR ( int index ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "const QPixmap * \fBpixmap\fR ( int index ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBchangeItem\fR ( const QListBoxItem * lbi, int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBchangeItem\fR ( const QString & text, int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBchangeItem\fR ( const QPixmap & pixmap, int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBchangeItem\fR ( const QPixmap & pixmap, const QString & text, int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBtakeItem\fR ( const QListBoxItem * item )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBnumItemsVisible\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBcurrentItem\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBcurrentText\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetCurrentItem\fR ( int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetCurrentItem\fR ( QListBoxItem * i )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void centerCurrentItem () \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBtopItem\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetTopItem\fR ( int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetBottomItem\fR ( int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "long \fBmaxItemWidth\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "enum \fBSelectionMode\fR { Single, Multi, Extended, NoSelection }"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetSelectionMode\fR ( SelectionMode )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "SelectionMode \fBselectionMode\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void setMultiSelection ( bool multi ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool isMultiSelection () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetSelected\fR ( QListBoxItem * item, bool select )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsetSelected\fR ( int index, bool select )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisSelected\fR ( int i ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisSelected\fR ( const QListBoxItem * i ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QListBoxItem * \fBselectedItem\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QListBoxItem * \fBitem\fR ( int index ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBindex\fR ( const QListBoxItem * lbi ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QListBoxItem * \fBfindItem\fR ( const QString & text, ComparisonFlags compare = BeginsWith ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBtriggerUpdate\fR ( bool doLayout )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBitemVisible\fR ( int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBitemVisible\fR ( const QListBoxItem * item )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "enum \fBLayoutMode\fR { FixedNumber, FitToWidth, FitToHeight = FitToWidth, Variable }"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetColumnMode\fR ( LayoutMode )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetColumnMode\fR ( int )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetRowMode\fR ( LayoutMode )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetRowMode\fR ( int )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "LayoutMode \fBcolumnMode\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "LayoutMode \fBrowMode\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBnumColumns\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBnumRows\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBvariableWidth\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetVariableWidth\fR ( bool )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBvariableHeight\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBsetVariableHeight\fR ( bool )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool autoScrollBar () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void setAutoScrollBar ( bool enable ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool scrollBar () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void setScrollBar ( bool enable ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool autoBottomScrollBar () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void setAutoBottomScrollBar ( bool enable ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool bottomScrollBar () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void setBottomScrollBar ( bool enable ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int inSort ( const QListBoxItem * lbi ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int inSort ( const QString & text ) \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int cellHeight ( int i ) const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int cellHeight () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int cellWidth () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int numCols () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBitemHeight\fR ( int index = 0 ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QListBoxItem * \fBitemAt\fR ( const QPoint & p ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QRect \fBitemRect\fR ( QListBoxItem * item ) const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QListBoxItem * \fBfirstItem\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBsort\fR ( bool ascending = TRUE )"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Public Slots"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "void \fBclear\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBensureCurrentVisible\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBclearSelection\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBselectAll\fR ( bool select )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBinvertSelection\fR ()"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Signals"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "void \fBhighlighted\fR ( int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBselected\fR ( int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBhighlighted\fR ( const QString & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBselected\fR ( const QString & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBhighlighted\fR ( QListBoxItem * )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBselected\fR ( QListBoxItem * )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBselectionChanged\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBselectionChanged\fR ( QListBoxItem * item )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBcurrentChanged\fR ( QListBoxItem * item )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBclicked\fR ( QListBoxItem * item )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBclicked\fR ( QListBoxItem * item, const QPoint & pnt )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBpressed\fR ( QListBoxItem * item )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBpressed\fR ( QListBoxItem * item, const QPoint & pnt )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBdoubleClicked\fR ( QListBoxItem * item )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBreturnPressed\fR ( QListBoxItem * )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBrightButtonClicked\fR ( QListBoxItem *, const QPoint & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBrightButtonPressed\fR ( QListBoxItem *, const QPoint & )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmouseButtonPressed\fR ( int button, QListBoxItem * item, const QPoint & pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBmouseButtonClicked\fR ( int button, QListBoxItem * item, const QPoint & pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBcontextMenuRequested\fR ( QListBoxItem * item, const QPoint & pos )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBonItem\fR ( QListBoxItem * i )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBonViewport\fR ()"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Properties"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "LayoutMode \fBcolumnMode\fR - the column layout mode for this list box"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "uint \fBcount\fR - the number of items in the list box \fI(read " "only" ")\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBcurrentItem\fR - the current highlighted item"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "QString \fBcurrentText\fR - the text of the current item \fI(read " "only" ")\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool multiSelection - whether or not the list box is in Multi selection mode \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBnumColumns\fR - the number of columns in the list box \fI(read " "only" ")\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBnumItemsVisible\fR - the number of visible items \fI(read " "only" ")\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBnumRows\fR - the number of rows in the list box \fI(read " "only" ")\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "LayoutMode \fBrowMode\fR - the row layout mode for this list box"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "SelectionMode \fBselectionMode\fR - the selection mode of the list box"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int \fBtopItem\fR - the index of an item at the top of the screen"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBvariableHeight\fR - whether this list box has variable-height rows"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBvariableWidth\fR - whether this list box has variable-width columns"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SS "Protected Members"
|
||
|
.in +1c
|
||
|
.ti -1c
|
||
|
.BI "void \fBupdateItem\fR ( int index )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBupdateItem\fR ( QListBoxItem * i )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int totalWidth () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int totalHeight () const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "virtual void \fBpaintCell\fR ( QPainter * p, int row, int col )"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBtoggleCurrentItem\fR ()"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool \fBisRubberSelecting\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "void \fBdoLayout\fR () const"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "bool itemYPos ( int index, int * yPos ) const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.ti -1c
|
||
|
.BI "int findItem ( int yPos ) const \fI(obsolete)\fR"
|
||
|
.br
|
||
|
.in -1c
|
||
|
.SH DESCRIPTION
|
||
|
The QListBox widget provides a list of selectable, read-only items.
|
||
|
.PP
|
||
|
This is typically a single-column list in which either no item or one item is selected, but it can also be used in many other ways.
|
||
|
.PP
|
||
|
QListBox will add scroll bars as necessary, but it isn't intended for \fIreally\fR big lists. If you want more than a few thousand items, it's probably better to use a different widget mainly because the scroll bars won't provide very good navigation, but also because QListBox may become slow with huge lists. (See QListView and QTable for possible alternatives.)
|
||
|
.PP
|
||
|
There are a variety of selection modes described in the QListBox::SelectionMode documentation. The default is Single selection mode, but you can change it using setSelectionMode(). (setMultiSelection() is still provided for compatibility with Qt 1.x. We recommend using setSelectionMode() in all code.)
|
||
|
.PP
|
||
|
Because QListBox offers multiple selection it must display keyboard focus and selection state separately. Therefore there are functions both to set the selection state of an item, i.e. setSelected(), and to set which item displays keyboard focus, i.e. setCurrentItem().
|
||
|
.PP
|
||
|
The list box normally arranges its items in a single column and adds a vertical scroll bar if retquired. It is possible to have a different fixed number of columns (setColumnMode()), or as many columns as will fit in the list box's assigned screen space (setColumnMode(FitToWidth)), or to have a fixed number of rows (setRowMode()) or as many rows as will fit in the list box's assigned screen space (setRowMode(FitToHeight)). In all these cases QListBox will add scroll bars, as appropriate, in at least one direction.
|
||
|
.PP
|
||
|
If multiple rows are used, each row can be as high as necessary (the normal setting), or you can request that all items will have the same height by calling setVariableHeight(FALSE). The same applies to a column's width, see setVariableWidth().
|
||
|
.PP
|
||
|
The QListBox's items are QListBoxItem objects. QListBox provides methods to insert new items as strings, as pixmaps, and as QListBoxItem * (insertItem() with various arguments), and to replace an existing item with a new string, pixmap or QListBoxItem (changeItem() with various arguments). You can also remove items singly with removeItem() or clear() the entire list box. Note that if you create a QListBoxItem yourself and insert it, QListBox takes ownership of the item.
|
||
|
.PP
|
||
|
You can also create a QListBoxItem, such as QListBoxText or QListBoxPixmap, with the list box as first parameter. The item will then append itself. When you delete an item it is automatically removed from the list box.
|
||
|
.PP
|
||
|
The list of items can be arbitrarily large; QListBox will add scroll bars if necessary. QListBox can display a single-column (the common case) or multiple-columns, and offers both single and multiple selection. QListBox does not support multiple-column items (but QListView and QTable do), or tree hierarchies (but QListView does).
|
||
|
.PP
|
||
|
The list box items can be accessed both as QListBoxItem objects (recommended) and using integer indexes (the original QListBox implementation used an array of strings internally, and the API still supports this mode of operation). Everything can be done using the new objects, and most things can be done using indexes.
|
||
|
.PP
|
||
|
Each item in a QListBox contains a QListBoxItem. One of the items can be the current item. The currentChanged() signal and the highlighted() signal are emitted when a new item becomes current, e.g. because the user clicks on it or QListBox::setCurrentItem() is called. The selected() signal is emitted when the user double-clicks on an item or presses Enter on the current item.
|
||
|
.PP
|
||
|
If the user does not select anything, no signals are emitted and currentItem() returns -1.
|
||
|
.PP
|
||
|
A list box has WheelFocus as a default focusPolicy(), i.e. it can get keyboard focus by tabbing, clicking and through the use of the mouse wheel.
|
||
|
.PP
|
||
|
New items can be inserted using insertItem(), insertStrList() or insertStringList(). inSort() is obsolete because this method is tquite inefficient. It's preferable to insert the items normally and call sort() afterwards, or to insert a sorted QStringList().
|
||
|
.PP
|
||
|
By default, vertical and horizontal scroll bars are added and removed as necessary. setHScrollBarMode() and setVScrollBarMode() can be used to change this policy.
|
||
|
.PP
|
||
|
If you need to insert types other than strings and pixmaps, you must define new classes which inherit QListBoxItem.
|
||
|
.PP
|
||
|
\fBWarning:\fR The list box assumes ownership of all list box items and will delete them when it does not need them any more.
|
||
|
.PP
|
||
|
.ce 1
|
||
|
.B "[Image Omitted]"
|
||
|
.PP
|
||
|
|
||
|
.ce 1
|
||
|
.B "[Image Omitted]"
|
||
|
.PP
|
||
|
See also QListView, QComboBox, QButtonGroup, GUI Design Handbook: List Box (two sections), and Advanced Widgets.
|
||
|
.SS "Member Type Documentation"
|
||
|
.SH "QListBox::LayoutMode"
|
||
|
This enum type is used to specify how QListBox lays out its rows and columns.
|
||
|
.TP
|
||
|
\fCQListBox::FixedNumber\fR - There is a fixed number of rows (or columns).
|
||
|
.TP
|
||
|
\fCQListBox::FitToWidth\fR - There are as many columns as will fit on-screen.
|
||
|
.TP
|
||
|
\fCQListBox::FitToHeight\fR - There are as many rows as will fit on-screen.
|
||
|
.TP
|
||
|
\fCQListBox::Variable\fR - There are as many rows as are retquired by the column mode. (Or as many columns as retquired by the row mode.)
|
||
|
.PP
|
||
|
Example: When you call setRowMode( FitToHeight ), columnMode() automatically becomes Variable to accommodate the row mode you've set.
|
||
|
.SH "QListBox::SelectionMode"
|
||
|
This enumerated type is used by QListBox to indicate how it reacts to selection by the user.
|
||
|
.TP
|
||
|
\fCQListBox::Single\fR - When the user selects an item, any already-selected item becomes unselected and the user cannot unselect the selected item. This means that the user can never clear the selection, even though the selection may be cleared by the application programmer using QListBox::clearSelection().
|
||
|
.TP
|
||
|
\fCQListBox::Multi\fR - When the user selects an item the selection status of that item is toggled and the other items are left alone. Also, multiple items can be selected by dragging the mouse while the left mouse button is kept pressed.
|
||
|
.TP
|
||
|
\fCQListBox::Extended\fR - When the user selects an item the selection is cleared and the new item selected. However, if the user presses the Ctrl key when clicking on an item, the clicked item gets toggled and all other items are left untouched. And if the user presses the Shift key while clicking on an item, all items between the current item and the clicked item get selected or unselected, depending on the state of the clicked item. Also, multiple items can be selected by dragging the mouse while the left mouse button is kept pressed.
|
||
|
.TP
|
||
|
\fCQListBox::NoSelection\fR - Items cannot be selected.
|
||
|
.PP
|
||
|
In other words, Single is a real single-selection list box, Multi is a real multi-selection list box, Extended is a list box in which users can select multiple items but usually want to select either just one or a range of contiguous items, and NoSelection is for a list box where the user can look but not touch.
|
||
|
.SH MEMBER FUNCTION DOCUMENTATION
|
||
|
.SH "QListBox::QListBox ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )"
|
||
|
Constructs a new empty list box called \fIname\fR and with parent \fIparent\fR.
|
||
|
.PP
|
||
|
Performance is boosted by modifying the widget flags \fIf\fR so that only part of the QListBoxItem children is redrawn. This may be unsuitable for custom QListBoxItem classes, in which case WStaticContents and WNoAutoErase should be cleared immediately after construction.
|
||
|
.PP
|
||
|
See also QWidget::clearWFlags() and Qt::WidgetFlags.
|
||
|
.SH "QListBox::~QListBox ()"
|
||
|
Destroys the list box. Deletes all list box items.
|
||
|
.SH "bool QListBox::autoBottomScrollBar () const"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns TRUE if hScrollBarMode() is Auto; otherwise returns FALSE.
|
||
|
.SH "bool QListBox::autoScrollBar () const"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns TRUE if vScrollBarMode() is Auto; otherwise returns FALSE.
|
||
|
.SH "bool QListBox::bottomScrollBar () const"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns FALSE if vScrollBarMode() is AlwaysOff; otherwise returns TRUE.
|
||
|
.SH "int QListBox::cellHeight ( int i ) const"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns the item height of item \fIi\fR.
|
||
|
.PP
|
||
|
See also itemHeight().
|
||
|
.SH "int QListBox::cellHeight () const"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Returns the item height of the first item, item 0.
|
||
|
.PP
|
||
|
See also itemHeight().
|
||
|
.SH "int QListBox::cellWidth () const"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns the maximum item width.
|
||
|
.PP
|
||
|
See also maxItemWidth().
|
||
|
.SH "void QListBox::centerCurrentItem ()"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
This function does exactly the same as ensureCurrentVisible()
|
||
|
.PP
|
||
|
See also QListBox::ensureCurrentVisible().
|
||
|
.SH "void QListBox::changeItem ( const QListBoxItem * lbi, int index )"
|
||
|
Replaces the item at position \fIindex\fR with \fIlbi\fR. If \fIindex\fR is negative or too large, changeItem() does nothing.
|
||
|
.PP
|
||
|
The item that has been changed will become selected.
|
||
|
.PP
|
||
|
See also insertItem() and removeItem().
|
||
|
.SH "void QListBox::changeItem ( const QString & text, int index )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Replaces the item at position \fIindex\fR with a new list box text item with text \fItext\fR.
|
||
|
.PP
|
||
|
The operation is ignored if \fIindex\fR is out of range.
|
||
|
.PP
|
||
|
See also insertItem() and removeItem().
|
||
|
.SH "void QListBox::changeItem ( const QPixmap & pixmap, int index )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Replaces the item at position \fIindex\fR with a new list box pixmap item with pixmap \fIpixmap\fR.
|
||
|
.PP
|
||
|
The operation is ignored if \fIindex\fR is out of range.
|
||
|
.PP
|
||
|
See also insertItem() and removeItem().
|
||
|
.SH "void QListBox::changeItem ( const QPixmap & pixmap, const QString & text, int index )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Replaces the item at position \fIindex\fR with a new list box pixmap item with pixmap \fIpixmap\fR and text \fItext\fR.
|
||
|
.PP
|
||
|
The operation is ignored if \fIindex\fR is out of range.
|
||
|
.PP
|
||
|
See also insertItem() and removeItem().
|
||
|
.SH "void QListBox::clear ()\fC [slot]\fR"
|
||
|
Deletes all the items in the list.
|
||
|
.PP
|
||
|
See also removeItem().
|
||
|
.SH "void QListBox::clearSelection ()\fC [virtual slot]\fR"
|
||
|
Deselects all items, if possible.
|
||
|
.PP
|
||
|
Note that a Single selection list box will automatically select an item if it has keyboard focus.
|
||
|
.PP
|
||
|
Example: listbox/listbox.cpp.
|
||
|
.SH "void QListBox::clicked ( QListBoxItem * item )\fC [signal]\fR"
|
||
|
This signal is emitted when the user clicks any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
|
||
|
.PP
|
||
|
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
|
||
|
.SH "void QListBox::clicked ( QListBoxItem * item, const QPoint & pnt )\fC [signal]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
This signal is emitted when the user clicks any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
|
||
|
.PP
|
||
|
\fIpnt\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differs by a pixel or two, \fIpnt\fR is the position at release time.)
|
||
|
.PP
|
||
|
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
|
||
|
.SH "LayoutMode QListBox::columnMode () const"
|
||
|
Returns the column layout mode for this list box. See the "columnMode" property for details.
|
||
|
.SH "void QListBox::contextMenuRequested ( QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"
|
||
|
This signal is emitted when the user invokes a context menu with the right mouse button or with special system keys, with \fIitem\fR being the item under the mouse cursor or the current item, respectively.
|
||
|
.PP
|
||
|
\fIpos\fR is the position for the context menu in the global coordinate system.
|
||
|
.SH "uint QListBox::count () const"
|
||
|
Returns the number of items in the list box. See the "count" property for details.
|
||
|
.SH "void QListBox::currentChanged ( QListBoxItem * item )\fC [signal]\fR"
|
||
|
This signal is emitted when the user makes a new item the current item. \fIitem\fR is the new current list box item.
|
||
|
.PP
|
||
|
See also currentItem and currentItem.
|
||
|
.SH "int QListBox::currentItem () const"
|
||
|
Returns the current highlighted item. See the "currentItem" property for details.
|
||
|
.SH "QString QListBox::currentText () const"
|
||
|
Returns the text of the current item. See the "currentText" property for details.
|
||
|
.SH "void QListBox::doLayout () const\fC [protected]\fR"
|
||
|
This function does the hard layout work. You should never need to call it.
|
||
|
.SH "void QListBox::doubleClicked ( QListBoxItem * item )\fC [signal]\fR"
|
||
|
This signal is emitted whenever an item is double-clicked. It's emitted on the second button press, not the second button release. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
|
||
|
.SH "void QListBox::ensureCurrentVisible ()\fC [virtual slot]\fR"
|
||
|
Ensures that the current item is visible.
|
||
|
.SH "QListBoxItem * QListBox::findItem ( const QString & text, ComparisonFlags compare = BeginsWith ) const"
|
||
|
Finds the first list box item that has the text \fItext\fR and returns it, or returns 0 of no such item could be found. The search starts from the current item if the current item exists, otherwise it starts from the first list box item. If \fCComparisonFlags\fR are specified in \fIcompare\fR then these flags are used, otherwise the default is a case-insensitive, "begins with" search.
|
||
|
.PP
|
||
|
See also Qt::StringComparisonMode.
|
||
|
.SH "int QListBox::findItem ( int yPos ) const\fC [protected]\fR"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns the index of the item a point (0, \fIyPos\fR).
|
||
|
.PP
|
||
|
See also index() and itemAt().
|
||
|
.SH "QListBoxItem * QListBox::firstItem () const"
|
||
|
Returns the first item in this list box. If the list box is empty, returns 0.
|
||
|
.SH "void QListBox::highlighted ( int index )\fC [signal]\fR"
|
||
|
This signal is emitted when the user makes a new item the current item. \fIindex\fR is the index of the new current item.
|
||
|
.PP
|
||
|
See also currentChanged(), selected(), currentItem, and selectionChanged().
|
||
|
.SH "void QListBox::highlighted ( const QString & )\fC [signal]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
This signal is emitted when the user makes a new item the current item and the item is (or has) a string. The argument is the text of the new current item.
|
||
|
.PP
|
||
|
See also currentChanged(), selected(), currentItem, and selectionChanged().
|
||
|
.SH "void QListBox::highlighted ( QListBoxItem * )\fC [signal]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
This signal is emitted when the user makes a new item the current item. The argument is a pointer to the new current item.
|
||
|
.PP
|
||
|
See also currentChanged(), selected(), currentItem, and selectionChanged().
|
||
|
.SH "int QListBox::inSort ( const QListBoxItem * lbi )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Using this method is tquite inefficient. We suggest to use insertItem() for inserting and sort() afterwards.
|
||
|
.PP
|
||
|
Inserts \fIlbi\fR at its sorted position in the list box and returns the position.
|
||
|
.PP
|
||
|
All items must be inserted with inSort() to maintain the sorting order. inSort() treats any pixmap (or user-defined type) as lexicographically less than any string.
|
||
|
.PP
|
||
|
See also insertItem() and sort().
|
||
|
.SH "int QListBox::inSort ( const QString & text )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Using this method is tquite inefficient. We suggest to use insertItem() for inserting and sort() afterwards.
|
||
|
.PP
|
||
|
Inserts a new item of \fItext\fR at its sorted position in the list box and returns the position.
|
||
|
.PP
|
||
|
All items must be inserted with inSort() to maintain the sorting order. inSort() treats any pixmap (or user-defined type) as lexicographically less than any string.
|
||
|
.PP
|
||
|
See also insertItem() and sort().
|
||
|
.SH "int QListBox::index ( const QListBoxItem * lbi ) const"
|
||
|
Returns the index of \fIlbi\fR, or -1 if the item is not in this list box or \fIlbi\fR is 0.
|
||
|
.PP
|
||
|
See also item().
|
||
|
.SH "void QListBox::insertItem ( const QListBoxItem * lbi, int index = -1 )"
|
||
|
Inserts the item \fIlbi\fR into the list at position \fIindex\fR.
|
||
|
.PP
|
||
|
If \fIindex\fR is negative or larger than the number of items in the list box, \fIlbi\fR is inserted at the end of the list.
|
||
|
.PP
|
||
|
See also insertStrList().
|
||
|
.PP
|
||
|
Examples:
|
||
|
.)l i18n/mywidget.cpp, listbox/listbox.cpp, listboxcombo/listboxcombo.cpp, and tabdialog/tabdialog.cpp.
|
||
|
.SH "void QListBox::insertItem ( const QListBoxItem * lbi, const QListBoxItem * after )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Inserts the item \fIlbi\fR into the list after the item \fIafter\fR, or at the beginning if \fIafter\fR is 0.
|
||
|
.PP
|
||
|
See also insertStrList().
|
||
|
.SH "void QListBox::insertItem ( const QString & text, int index = -1 )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Inserts a new list box text item with the text \fItext\fR into the list at position \fIindex\fR.
|
||
|
.PP
|
||
|
If \fIindex\fR is negative, \fItext\fR is inserted at the end of the list.
|
||
|
.PP
|
||
|
See also insertStrList().
|
||
|
.SH "void QListBox::insertItem ( const QPixmap & pixmap, int index = -1 )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Inserts a new list box pixmap item with the pixmap \fIpixmap\fR into the list at position \fIindex\fR.
|
||
|
.PP
|
||
|
If \fIindex\fR is negative, \fIpixmap\fR is inserted at the end of the list.
|
||
|
.PP
|
||
|
See also insertStrList().
|
||
|
.SH "void QListBox::insertItem ( const QPixmap & pixmap, const QString & text, int index = -1 )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Inserts a new list box pixmap item with the pixmap \fIpixmap\fR and the text \fItext\fR into the list at position \fIindex\fR.
|
||
|
.PP
|
||
|
If \fIindex\fR is negative, \fIpixmap\fR is inserted at the end of the list.
|
||
|
.PP
|
||
|
See also insertStrList().
|
||
|
.SH "void QListBox::insertStrList ( const QStrList * list, int index = -1 )"
|
||
|
Inserts the string list \fIlist\fR into the list at position \fIindex\fR.
|
||
|
.PP
|
||
|
If \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored.
|
||
|
.PP
|
||
|
\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings.
|
||
|
.PP
|
||
|
\fBWarning:\fR This function is never significantly faster than a loop around insertItem().
|
||
|
.PP
|
||
|
See also insertItem() and insertStringList().
|
||
|
.SH "void QListBox::insertStrList ( const QStrList & list, int index = -1 )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Inserts the string list \fIlist\fR into the list at position \fIindex\fR.
|
||
|
.PP
|
||
|
If \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored.
|
||
|
.PP
|
||
|
\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings.
|
||
|
.PP
|
||
|
\fBWarning:\fR This function is never significantly faster than a loop around insertItem().
|
||
|
.PP
|
||
|
See also insertItem() and insertStringList().
|
||
|
.SH "void QListBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Inserts the \fInumStrings\fR strings of the array \fIstrings\fR into the list at position \fIindex\fR.
|
||
|
.PP
|
||
|
If \fIindex\fR is negative, insertStrList() inserts \fIstrings\fR at the end of the list. If \fIindex\fR is too large, the operation is ignored.
|
||
|
.PP
|
||
|
\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings.
|
||
|
.PP
|
||
|
\fBWarning:\fR This function is never significantly faster than a loop around insertItem().
|
||
|
.PP
|
||
|
See also insertItem() and insertStringList().
|
||
|
.SH "void QListBox::insertStringList ( const QStringList & list, int index = -1 )"
|
||
|
Inserts the string list \fIlist\fR into the list at position \fIindex\fR.
|
||
|
.PP
|
||
|
If \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored.
|
||
|
.PP
|
||
|
\fBWarning:\fR This function is never significantly faster than a loop around insertItem().
|
||
|
.PP
|
||
|
See also insertItem() and insertStrList().
|
||
|
.SH "void QListBox::invertSelection ()\fC [virtual slot]\fR"
|
||
|
Inverts the selection. Only works in Multi and Extended selection mode.
|
||
|
.SH "bool QListBox::isMultiSelection () const"
|
||
|
Returns TRUE if or not the list box is in Multi selection mode; otherwise returns FALSE. See the "multiSelection" property for details.
|
||
|
.SH "bool QListBox::isRubberSelecting () const\fC [protected]\fR"
|
||
|
Returns TRUE if the user is selecting items using a rubber band rectangle; otherwise returns FALSE.
|
||
|
.SH "bool QListBox::isSelected ( int i ) const"
|
||
|
Returns TRUE if item \fIi\fR is selected; otherwise returns FALSE.
|
||
|
.SH "bool QListBox::isSelected ( const QListBoxItem * i ) const"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Returns TRUE if item \fIi\fR is selected; otherwise returns FALSE.
|
||
|
.SH "QListBoxItem * QListBox::item ( int index ) const"
|
||
|
Returns a pointer to the item at position \fIindex\fR, or 0 if \fIindex\fR is out of bounds.
|
||
|
.PP
|
||
|
See also index().
|
||
|
.PP
|
||
|
Example: listboxcombo/listboxcombo.cpp.
|
||
|
.SH "QListBoxItem * QListBox::itemAt ( const QPoint & p ) const"
|
||
|
Returns the item at point \fIp\fR, specified in viewport coordinates, or a 0 if there is no item at \fIp\fR.
|
||
|
.PP
|
||
|
Use contentsToViewport() to convert between widget coordinates and viewport coordinates.
|
||
|
.SH "int QListBox::itemHeight ( int index = 0 ) const"
|
||
|
Returns the height in pixels of the item with index \fIindex\fR. \fIindex\fR defaults to 0.
|
||
|
.PP
|
||
|
If \fIindex\fR is too large, this function returns 0.
|
||
|
.SH "QRect QListBox::itemRect ( QListBoxItem * item ) const"
|
||
|
Returns the rectangle on the screen that \fIitem\fR occupies in viewport()'s coordinates, or an invalid rectangle if \fIitem\fR is 0 or is not currently visible.
|
||
|
.SH "bool QListBox::itemVisible ( int index )"
|
||
|
Returns TRUE if the item at position \fIindex\fR is at least partly visible; otherwise returns FALSE.
|
||
|
.SH "bool QListBox::itemVisible ( const QListBoxItem * item )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Returns TRUE if \fIitem\fR is at least partly visible; otherwise returns FALSE.
|
||
|
.SH "bool QListBox::itemYPos ( int index, int * yPos ) const\fC [protected]\fR"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns the vertical pixel-coordinate in \fI*yPos\fR, of the list box item at position \fIindex\fR in the list. Returns FALSE if the item is outside the visible area.
|
||
|
.SH "long QListBox::maxItemWidth () const"
|
||
|
Returns the width of the widest item in the list box.
|
||
|
.SH "void QListBox::mouseButtonClicked ( int button, QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"
|
||
|
This signal is emitted when the user clicks mouse button \fIbutton\fR. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
|
||
|
.PP
|
||
|
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differs by a pixel or two, \fIpos\fR is the position at release time.)
|
||
|
.PP
|
||
|
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
|
||
|
.SH "void QListBox::mouseButtonPressed ( int button, QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"
|
||
|
This signal is emitted when the user presses mouse button \fIbutton\fR. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
|
||
|
.PP
|
||
|
\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()).
|
||
|
.PP
|
||
|
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
|
||
|
.SH "int QListBox::numCols () const"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns the number of columns.
|
||
|
.PP
|
||
|
See also numColumns.
|
||
|
.SH "int QListBox::numColumns () const"
|
||
|
Returns the number of columns in the list box. See the "numColumns" property for details.
|
||
|
.SH "int QListBox::numItemsVisible () const"
|
||
|
Returns the number of visible items. See the "numItemsVisible" property for details.
|
||
|
.SH "int QListBox::numRows () const"
|
||
|
Returns the number of rows in the list box. See the "numRows" property for details.
|
||
|
.SH "void QListBox::onItem ( QListBoxItem * i )\fC [signal]\fR"
|
||
|
This signal is emitted when the user moves the mouse cursor onto an item, similar to the QWidget::enterEvent() function. \fIi\fR is the QListBoxItem that the mouse has moved on.
|
||
|
.SH "void QListBox::onViewport ()\fC [signal]\fR"
|
||
|
This signal is emitted when the user moves the mouse cursor from an item to an empty part of the list box.
|
||
|
.SH "void QListBox::paintCell ( QPainter * p, int row, int col )\fC [virtual protected]\fR"
|
||
|
Provided for compatibility with the old QListBox. We recommend using QListBoxItem::paint() instead.
|
||
|
.PP
|
||
|
Repaints the cell at \fIrow\fR, \fIcol\fR using painter \fIp\fR.
|
||
|
.SH "const QPixmap * QListBox::pixmap ( int index ) const"
|
||
|
Returns a pointer to the pixmap at position \fIindex\fR, or 0 if there is no pixmap there.
|
||
|
.PP
|
||
|
See also text().
|
||
|
.SH "void QListBox::pressed ( QListBoxItem * item )\fC [signal]\fR"
|
||
|
This signal is emitted when the user presses any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
|
||
|
.PP
|
||
|
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
|
||
|
.SH "void QListBox::pressed ( QListBoxItem * item, const QPoint & pnt )\fC [signal]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
This signal is emitted when the user presses any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item.
|
||
|
.PP
|
||
|
\fIpnt\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()).
|
||
|
.PP
|
||
|
Note that you must not delete any QListBoxItem objects in slots connected to this signal.
|
||
|
.PP
|
||
|
See also mouseButtonPressed(), rightButtonPressed(), and clicked().
|
||
|
.SH "void QListBox::removeItem ( int index )"
|
||
|
Removes and deletes the item at position \fIindex\fR. If \fIindex\fR is equal to currentItem(), a new item becomes current and the currentChanged() and highlighted() signals are emitted.
|
||
|
.PP
|
||
|
See also insertItem() and clear().
|
||
|
.SH "void QListBox::returnPressed ( QListBoxItem * )\fC [signal]\fR"
|
||
|
This signal is emitted when Enter or Return is pressed. The argument is currentItem().
|
||
|
.SH "void QListBox::rightButtonClicked ( QListBoxItem *, const QPoint & )\fC [signal]\fR"
|
||
|
This signal is emitted when the right button is clicked (i.e. when it's released at the same point where it was pressed). The arguments are the relevant QListBoxItem (may be 0) and the point in global coordinates.
|
||
|
.SH "void QListBox::rightButtonPressed ( QListBoxItem *, const QPoint & )\fC [signal]\fR"
|
||
|
This signal is emitted when the right button is pressed. The arguments are the relevant QListBoxItem (may be 0) and the point in global coordinates.
|
||
|
.SH "LayoutMode QListBox::rowMode () const"
|
||
|
Returns the row layout mode for this list box. See the "rowMode" property for details.
|
||
|
.SH "bool QListBox::scrollBar () const"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns FALSE if vScrollBarMode() is AlwaysOff; otherwise returns TRUE.
|
||
|
.SH "void QListBox::selectAll ( bool select )\fC [virtual slot]\fR"
|
||
|
In Multi and Extended modes, this function sets all items to be selected if \fIselect\fR is TRUE, and to be unselected if \fIselect\fR is FALSE.
|
||
|
.PP
|
||
|
In Single and NoSelection modes, this function only changes the selection status of currentItem().
|
||
|
.SH "void QListBox::selected ( int index )\fC [signal]\fR"
|
||
|
This signal is emitted when the user double-clicks on an item or presses Enter on the current item. \fIindex\fR is the index of the selected item.
|
||
|
.PP
|
||
|
See also currentChanged(), highlighted(), and selectionChanged().
|
||
|
.SH "void QListBox::selected ( const QString & )\fC [signal]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
This signal is emitted when the user double-clicks on an item or presses Enter on the current item, and the item is (or has) a string. The argument is the text of the selected item.
|
||
|
.PP
|
||
|
See also currentChanged(), highlighted(), and selectionChanged().
|
||
|
.SH "void QListBox::selected ( QListBoxItem * )\fC [signal]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
This signal is emitted when the user double-clicks on an item or presses Enter on the current item. The argument is a pointer to the new selected item.
|
||
|
.PP
|
||
|
See also currentChanged(), highlighted(), and selectionChanged().
|
||
|
.SH "QListBoxItem * QListBox::selectedItem () const"
|
||
|
Returns the selected item if the list box is in single-selection mode and an item is selected.
|
||
|
.PP
|
||
|
If no items are selected or the list box is in another selection mode this function returns 0.
|
||
|
.PP
|
||
|
See also setSelected() and multiSelection.
|
||
|
.SH "void QListBox::selectionChanged ()\fC [signal]\fR"
|
||
|
This signal is emitted when the selection set of a list box changes. This signal is emitted in each selection mode. If the user selects five items by drag-selecting, QListBox tries to emit just one selectionChanged() signal so the signal can be connected to computationally expensive slots.
|
||
|
.PP
|
||
|
See also selected() and currentItem.
|
||
|
.SH "void QListBox::selectionChanged ( QListBoxItem * item )\fC [signal]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
This signal is emitted when the selection in a Single selection list box changes. \fIitem\fR is the newly selected list box item.
|
||
|
.PP
|
||
|
See also selected() and currentItem.
|
||
|
.SH "SelectionMode QListBox::selectionMode () const"
|
||
|
Returns the selection mode of the list box. See the "selectionMode" property for details.
|
||
|
.SH "void QListBox::setAutoBottomScrollBar ( bool enable )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
If \fIenable\fR is TRUE sets setHScrollBarMode() to AlwaysOn; otherwise sets setHScrollBarMode() to AlwaysOff.
|
||
|
.SH "void QListBox::setAutoScrollBar ( bool enable )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
If \fIenable\fR is TRUE sets setVScrollBarMode() to AlwaysOn; otherwise sets setVScrollBarMode() to AlwaysOff.
|
||
|
.SH "void QListBox::setBottomItem ( int index )\fC [virtual]\fR"
|
||
|
Scrolls the list box so the item at position \fIindex\fR in the list is displayed in the bottom row of the list box.
|
||
|
.PP
|
||
|
See also topItem.
|
||
|
.SH "void QListBox::setBottomScrollBar ( bool enable )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
If \fIenable\fR is TRUE sets setHScrollBarMode() to AlwaysOn; otherwise sets setHScrollBarMode() to AlwaysOff.
|
||
|
.SH "void QListBox::setColumnMode ( LayoutMode )\fC [virtual]\fR"
|
||
|
Sets the column layout mode for this list box. See the "columnMode" property for details.
|
||
|
.SH "void QListBox::setColumnMode ( int )\fC [virtual]\fR"
|
||
|
Sets the column layout mode for this list box. See the "columnMode" property for details.
|
||
|
.SH "void QListBox::setCurrentItem ( int index )\fC [virtual]\fR"
|
||
|
Sets the current highlighted item to \fIindex\fR. See the "currentItem" property for details.
|
||
|
.SH "void QListBox::setCurrentItem ( QListBoxItem * i )\fC [virtual]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Sets the current item to the QListBoxItem \fIi\fR.
|
||
|
.SH "void QListBox::setMultiSelection ( bool multi )"
|
||
|
Sets whether or not the list box is in Multi selection mode to \fImulti\fR. See the "multiSelection" property for details.
|
||
|
.SH "void QListBox::setRowMode ( LayoutMode )\fC [virtual]\fR"
|
||
|
Sets the row layout mode for this list box. See the "rowMode" property for details.
|
||
|
.SH "void QListBox::setRowMode ( int )\fC [virtual]\fR"
|
||
|
Sets the row layout mode for this list box. See the "rowMode" property for details.
|
||
|
.SH "void QListBox::setScrollBar ( bool enable )"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
If \fIenable\fR is TRUE sets setVScrollBarMode() to AlwaysOn; otherwise sets setVScrollBarMode() to AlwaysOff.
|
||
|
.SH "void QListBox::setSelected ( QListBoxItem * item, bool select )\fC [virtual]\fR"
|
||
|
Selects \fIitem\fR if \fIselect\fR is TRUE or unselects it if \fIselect\fR is FALSE, and repaints the item appropriately.
|
||
|
.PP
|
||
|
If the list box is a Single selection list box and \fIselect\fR is TRUE, setSelected() calls setCurrentItem().
|
||
|
.PP
|
||
|
If the list box is a Single selection list box, \fIselect\fR is FALSE, setSelected() calls clearSelection().
|
||
|
.PP
|
||
|
See also multiSelection, currentItem, clearSelection(), and currentItem.
|
||
|
.SH "void QListBox::setSelected ( int index, bool select )"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
If \fIselect\fR is TRUE the item at position \fIindex\fR is selected; otherwise the item is deselected.
|
||
|
.SH "void QListBox::setSelectionMode ( SelectionMode )\fC [virtual]\fR"
|
||
|
Sets the selection mode of the list box. See the "selectionMode" property for details.
|
||
|
.SH "void QListBox::setTopItem ( int index )\fC [virtual]\fR"
|
||
|
Sets the index of an item at the top of the screen to \fIindex\fR. See the "topItem" property for details.
|
||
|
.SH "void QListBox::setVariableHeight ( bool )\fC [virtual]\fR"
|
||
|
Sets whether this list box has variable-height rows. See the "variableHeight" property for details.
|
||
|
.SH "void QListBox::setVariableWidth ( bool )\fC [virtual]\fR"
|
||
|
Sets whether this list box has variable-width columns. See the "variableWidth" property for details.
|
||
|
.SH "void QListBox::sort ( bool ascending = TRUE )"
|
||
|
If \fIascending\fR is TRUE sorts the items in ascending order; otherwise sorts in descending order.
|
||
|
.PP
|
||
|
To compare the items, the text (QListBoxItem::text()) of the items is used.
|
||
|
.PP
|
||
|
Example: listbox/listbox.cpp.
|
||
|
.SH "void QListBox::takeItem ( const QListBoxItem * item )"
|
||
|
Removes \fIitem\fR from the list box and causes an update of the screen display. The item is not deleted. You should normally not need to call this function because QListBoxItem::~QListBoxItem() calls it. The normal way to delete an item is with \fCdelete\fR.
|
||
|
.PP
|
||
|
See also QListBox::insertItem().
|
||
|
.SH "QString QListBox::text ( int index ) const"
|
||
|
Returns the text at position \fIindex\fR, or QString::null if there is no text at that position.
|
||
|
.PP
|
||
|
See also pixmap().
|
||
|
.SH "void QListBox::toggleCurrentItem ()\fC [protected]\fR"
|
||
|
Toggles the selection status of currentItem() and repaints if the list box is a Multi selection list box.
|
||
|
.PP
|
||
|
See also multiSelection.
|
||
|
.SH "int QListBox::topItem () const"
|
||
|
Returns the index of an item at the top of the screen. See the "topItem" property for details.
|
||
|
.SH "int QListBox::totalHeight () const\fC [protected]\fR"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns contentsHeight().
|
||
|
.SH "int QListBox::totalWidth () const\fC [protected]\fR"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
Returns contentsWidth().
|
||
|
.SH "void QListBox::triggerUpdate ( bool doLayout )"
|
||
|
Ensures that a single paint event will occur at the end of the current event loop iteration. If \fIdoLayout\fR is TRUE, the layout is also redone.
|
||
|
.SH "void QListBox::updateItem ( int index )\fC [protected]\fR"
|
||
|
Repaints the item at position \fIindex\fR in the list.
|
||
|
.SH "void QListBox::updateItem ( QListBoxItem * i )\fC [protected]\fR"
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
.PP
|
||
|
Repaints the QListBoxItem \fIi\fR.
|
||
|
.SH "bool QListBox::variableHeight () const"
|
||
|
Returns TRUE if this list box has variable-height rows; otherwise returns FALSE. See the "variableHeight" property for details.
|
||
|
.SH "bool QListBox::variableWidth () const"
|
||
|
Returns TRUE if this list box has variable-width columns; otherwise returns FALSE. See the "variableWidth" property for details.
|
||
|
.SS "Property Documentation"
|
||
|
.SH "LayoutMode columnMode"
|
||
|
This property holds the column layout mode for this list box.
|
||
|
.PP
|
||
|
setColumnMode() sets the layout mode and adjusts the number of displayed columns. The row layout mode automatically becomes Variable, unless the column mode is Variable.
|
||
|
.PP
|
||
|
See also rowMode, rowMode, and numColumns.
|
||
|
.PP
|
||
|
Set this property's value with setColumnMode() and get this property's value with columnMode().
|
||
|
.SH "uint count"
|
||
|
This property holds the number of items in the list box.
|
||
|
.PP
|
||
|
Get this property's value with count().
|
||
|
.SH "int currentItem"
|
||
|
This property holds the current highlighted item.
|
||
|
.PP
|
||
|
When setting this property, the highlighting is moved to the item and the list box scrolled as necessary.
|
||
|
.PP
|
||
|
If no item is current, currentItem() returns -1.
|
||
|
.PP
|
||
|
Set this property's value with setCurrentItem() and get this property's value with currentItem().
|
||
|
.SH "QString currentText"
|
||
|
This property holds the text of the current item.
|
||
|
.PP
|
||
|
This is equivalent to text(currentItem()).
|
||
|
.PP
|
||
|
Get this property's value with currentText().
|
||
|
.SH "bool multiSelection"
|
||
|
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
|
||
|
.PP
|
||
|
This property holds whether or not the list box is in Multi selection mode.
|
||
|
.PP
|
||
|
Consider using the QListBox::selectionMode property instead of this property.
|
||
|
.PP
|
||
|
When setting this property, Multi selection mode is used if set to TRUE and to Single selection mode if set to FALSE.
|
||
|
.PP
|
||
|
When getting this property, TRUE is returned if the list box is in Multi selection mode or Extended selection mode, and FALSE if it is in Single selection mode or NoSelection mode.
|
||
|
.PP
|
||
|
See also selectionMode.
|
||
|
.PP
|
||
|
Set this property's value with setMultiSelection() and get this property's value with isMultiSelection().
|
||
|
.SH "int numColumns"
|
||
|
This property holds the number of columns in the list box.
|
||
|
.PP
|
||
|
This is normally 1, but can be different if QListBox::columnMode or QListBox::rowMode has been set.
|
||
|
.PP
|
||
|
See also columnMode, rowMode, and numRows.
|
||
|
.PP
|
||
|
Get this property's value with numColumns().
|
||
|
.SH "int numItemsVisible"
|
||
|
This property holds the number of visible items.
|
||
|
.PP
|
||
|
Both partially and entirely visible items are counted.
|
||
|
.PP
|
||
|
Get this property's value with numItemsVisible().
|
||
|
.SH "int numRows"
|
||
|
This property holds the number of rows in the list box.
|
||
|
.PP
|
||
|
This is equal to the number of items in the default single-column layout, but can be different.
|
||
|
.PP
|
||
|
See also columnMode, rowMode, and numColumns.
|
||
|
.PP
|
||
|
Get this property's value with numRows().
|
||
|
.SH "LayoutMode rowMode"
|
||
|
This property holds the row layout mode for this list box.
|
||
|
.PP
|
||
|
This property is normally Variable.
|
||
|
.PP
|
||
|
setRowMode() sets the layout mode and adjusts the number of displayed rows. The column layout mode automatically becomes Variable, unless the row mode is Variable.
|
||
|
.PP
|
||
|
See also columnMode.
|
||
|
.PP
|
||
|
Set this property's value with setRowMode() and get this property's value with rowMode().
|
||
|
.SH "SelectionMode selectionMode"
|
||
|
This property holds the selection mode of the list box.
|
||
|
.PP
|
||
|
Sets the list box's selection mode, which may be one of Single (the default), Extended, Multi or NoSelection.
|
||
|
.PP
|
||
|
See also SelectionMode.
|
||
|
.PP
|
||
|
Set this property's value with setSelectionMode() and get this property's value with selectionMode().
|
||
|
.SH "int topItem"
|
||
|
This property holds the index of an item at the top of the screen.
|
||
|
.PP
|
||
|
When getting this property and the listbox has multiple columns, an arbitrary item is selected and returned.
|
||
|
.PP
|
||
|
When setting this property, the list box is scrolled so the item at position \fIindex\fR in the list is displayed in the top row of the list box.
|
||
|
.PP
|
||
|
Set this property's value with setTopItem() and get this property's value with topItem().
|
||
|
.SH "bool variableHeight"
|
||
|
This property holds whether this list box has variable-height rows.
|
||
|
.PP
|
||
|
When the list box has variable-height rows (the default), each row is as high as the highest item in that row. When it has same-sized rows, all rows are as high as the highest item in the list box.
|
||
|
.PP
|
||
|
See also variableWidth.
|
||
|
.PP
|
||
|
Set this property's value with setVariableHeight() and get this property's value with variableHeight().
|
||
|
.SH "bool variableWidth"
|
||
|
This property holds whether this list box has variable-width columns.
|
||
|
.PP
|
||
|
When the list box has variable-width columns, each column is as wide as the widest item in that column. When it has same-sized columns (the default), all columns are as wide as the widest item in the list box.
|
||
|
.PP
|
||
|
See also variableHeight.
|
||
|
.PP
|
||
|
Set this property's value with setVariableWidth() and get this property's value with variableWidth().
|
||
|
|
||
|
.SH "SEE ALSO"
|
||
|
.BR http://doc.trolltech.com/qlistbox.html
|
||
|
.BR http://www.trolltech.com/faq/tech.html
|
||
|
.SH COPYRIGHT
|
||
|
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
|
||
|
license file included in the distribution for a complete license
|
||
|
statement.
|
||
|
.SH AUTHOR
|
||
|
Generated automatically from the source code.
|
||
|
.SH BUGS
|
||
|
If you find a bug in Qt, please report it as described in
|
||
|
.BR http://doc.trolltech.com/bughowto.html .
|
||
|
Good bug reports help us to help you. Thank you.
|
||
|
.P
|
||
|
The definitive Qt documentation is provided in HTML format; it is
|
||
|
located at $QTDIR/doc/html and can be read using Qt Assistant or with
|
||
|
a web browser. This man page is provided as a convenience for those
|
||
|
users who prefer man pages, although this format is not officially
|
||
|
supported by Trolltech.
|
||
|
.P
|
||
|
If you find errors in this manual page, please report them to
|
||
|
.BR qt-bugs@trolltech.com .
|
||
|
Please include the name of the manual page (qlistbox.3qt) and the Qt
|
||
|
version (3.3.8).
|