<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt - 3.3.8 - espenr - 2499/qt - x11 - free - 3.3.8/src/widgets/qlistbox.cpp:805 -->
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1" >
< title > TQListBox Class< / title >
< style type = "text/css" > < ! - -
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
-->< / style >
< / head >
< body >
< table border = "0" cellpadding = "0" cellspacing = "0" width = "100%" >
< tr bgcolor = "#E5E5E5" >
< td valign = center >
< a href = "index.html" >
< font color = "#004faf" > Home< / font > < / a >
| < a href = "classes.html" >
< font color = "#004faf" > All Classes< / font > < / a >
| < a href = "mainclasses.html" >
< font color = "#004faf" > Main Classes< / font > < / a >
| < a href = "annotated.html" >
< font color = "#004faf" > Annotated< / font > < / a >
| < a href = "groups.html" >
< font color = "#004faf" > Grouped Classes< / font > < / a >
| < a href = "functions.html" >
< font color = "#004faf" > Functions< / font > < / a >
< / td >
< td align = "right" valign = "center" > < img src = "logo32.png" align = "right" width = "64" height = "32" border = "0" > < / td > < / tr > < / table > < h1 align = center > TQListBox Class Reference< / h1 >
< p > The TQListBox widget provides a list of selectable, read-only items.
< a href = "#details" > More...< / a >
< p > < tt > #include < < a href = "qlistbox-h.html" > ntqlistbox.h< / a > > < / tt >
< p > Inherits < a href = "ntqscrollview.html" > TQScrollView< / a > .
< p > < a href = "qlistbox-members.html" > List of all member functions.< / a >
< h2 > Public Members< / h2 >
< ul >
< li class = fn > < a href = "#TQListBox" > < b > TQListBox< / b > < / a > ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )< / li >
< li class = fn > < a href = "#~TQListBox" > < b > ~TQListBox< / b > < / a > ()< / li >
< li class = fn > uint < a href = "#count" > < b > count< / b > < / a > () const< / li >
< li class = fn > void < a href = "#insertStringList" > < b > insertStringList< / b > < / a > ( const TQStringList & list, int index = -1 )< / li >
< li class = fn > void < a href = "#insertStrList" > < b > insertStrList< / b > < / a > ( const TQStrList * list, int index = -1 )< / li >
< li class = fn > void < a href = "#insertStrList-2" > < b > insertStrList< / b > < / a > ( const TQStrList & list, int index = -1 )< / li >
< li class = fn > void < a href = "#insertStrList-3" > < b > insertStrList< / b > < / a > ( const char ** strings, int numStrings = -1, int index = -1 )< / li >
< li class = fn > void < a href = "#insertItem" > < b > insertItem< / b > < / a > ( const TQListBoxItem * lbi, int index = -1 )< / li >
< li class = fn > void < a href = "#insertItem-2" > < b > insertItem< / b > < / a > ( const TQListBoxItem * lbi, const TQListBoxItem * after )< / li >
< li class = fn > void < a href = "#insertItem-3" > < b > insertItem< / b > < / a > ( const TQString & text, int index = -1 )< / li >
< li class = fn > void < a href = "#insertItem-4" > < b > insertItem< / b > < / a > ( const TQPixmap & pixmap, int index = -1 )< / li >
< li class = fn > void < a href = "#insertItem-5" > < b > insertItem< / b > < / a > ( const TQPixmap & pixmap, const TQString & text, int index = -1 )< / li >
< li class = fn > void < a href = "#removeItem" > < b > removeItem< / b > < / a > ( int index )< / li >
< li class = fn > TQString < a href = "#text" > < b > text< / b > < / a > ( int index ) const< / li >
< li class = fn > const TQPixmap * < a href = "#pixmap" > < b > pixmap< / b > < / a > ( int index ) const< / li >
< li class = fn > void < a href = "#changeItem" > < b > changeItem< / b > < / a > ( const TQListBoxItem * lbi, int index )< / li >
< li class = fn > void < a href = "#changeItem-2" > < b > changeItem< / b > < / a > ( const TQString & text, int index )< / li >
< li class = fn > void < a href = "#changeItem-3" > < b > changeItem< / b > < / a > ( const TQPixmap & pixmap, int index )< / li >
< li class = fn > void < a href = "#changeItem-4" > < b > changeItem< / b > < / a > ( const TQPixmap & pixmap, const TQString & text, int index )< / li >
< li class = fn > void < a href = "#takeItem" > < b > takeItem< / b > < / a > ( const TQListBoxItem * item )< / li >
< li class = fn > int < a href = "#numItemsVisible" > < b > numItemsVisible< / b > < / a > () const< / li >
< li class = fn > int < a href = "#currentItem" > < b > currentItem< / b > < / a > () const< / li >
< li class = fn > TQString < a href = "#currentText" > < b > currentText< / b > < / a > () const< / li >
< li class = fn > virtual void < a href = "#setCurrentItem" > < b > setCurrentItem< / b > < / a > ( int index )< / li >
< li class = fn > virtual void < a href = "#setCurrentItem-2" > < b > setCurrentItem< / b > < / a > ( TQListBoxItem * i )< / li >
< li class = fn > void centerCurrentItem () < em > (obsolete)< / em > < / li >
< li class = fn > int < a href = "#topItem" > < b > topItem< / b > < / a > () const< / li >
< li class = fn > virtual void < a href = "#setTopItem" > < b > setTopItem< / b > < / a > ( int index )< / li >
< li class = fn > virtual void < a href = "#setBottomItem" > < b > setBottomItem< / b > < / a > ( int index )< / li >
< li class = fn > long < a href = "#maxItemWidth" > < b > maxItemWidth< / b > < / a > () const< / li >
< li class = fn > enum < a href = "#SelectionMode-enum" > < b > SelectionMode< / b > < / a > { Single, Multi, Extended, NoSelection }< / li >
< li class = fn > virtual void < a href = "#setSelectionMode" > < b > setSelectionMode< / b > < / a > ( SelectionMode )< / li >
< li class = fn > SelectionMode < a href = "#selectionMode" > < b > selectionMode< / b > < / a > () const< / li >
< li class = fn > void setMultiSelection ( bool multi ) < em > (obsolete)< / em > < / li >
< li class = fn > bool isMultiSelection () const < em > (obsolete)< / em > < / li >
< li class = fn > virtual void < a href = "#setSelected" > < b > setSelected< / b > < / a > ( TQListBoxItem * item, bool select )< / li >
< li class = fn > void < a href = "#setSelected-2" > < b > setSelected< / b > < / a > ( int index, bool select )< / li >
< li class = fn > bool < a href = "#isSelected" > < b > isSelected< / b > < / a > ( int i ) const< / li >
< li class = fn > bool < a href = "#isSelected-2" > < b > isSelected< / b > < / a > ( const TQListBoxItem * i ) const< / li >
< li class = fn > TQListBoxItem * < a href = "#selectedItem" > < b > selectedItem< / b > < / a > () const< / li >
< li class = fn > TQListBoxItem * < a href = "#item" > < b > item< / b > < / a > ( int index ) const< / li >
< li class = fn > int < a href = "#index" > < b > index< / b > < / a > ( const TQListBoxItem * lbi ) const< / li >
< li class = fn > TQListBoxItem * < a href = "#findItem" > < b > findItem< / b > < / a > ( const TQString & text, ComparisonFlags compare = BeginsWith ) const< / li >
< li class = fn > void < a href = "#triggerUpdate" > < b > triggerUpdate< / b > < / a > ( bool doLayout )< / li >
< li class = fn > bool < a href = "#itemVisible" > < b > itemVisible< / b > < / a > ( int index )< / li >
< li class = fn > bool < a href = "#itemVisible-2" > < b > itemVisible< / b > < / a > ( const TQListBoxItem * item )< / li >
< li class = fn > enum < a href = "#LayoutMode-enum" > < b > LayoutMode< / b > < / a > { FixedNumber, FitToWidth, FitToHeight = FitToWidth, Variable }< / li >
< li class = fn > virtual void < a href = "#setColumnMode" > < b > setColumnMode< / b > < / a > ( LayoutMode )< / li >
< li class = fn > virtual void < a href = "#setColumnMode-2" > < b > setColumnMode< / b > < / a > ( int )< / li >
< li class = fn > virtual void < a href = "#setRowMode" > < b > setRowMode< / b > < / a > ( LayoutMode )< / li >
< li class = fn > virtual void < a href = "#setRowMode-2" > < b > setRowMode< / b > < / a > ( int )< / li >
< li class = fn > LayoutMode < a href = "#columnMode" > < b > columnMode< / b > < / a > () const< / li >
< li class = fn > LayoutMode < a href = "#rowMode" > < b > rowMode< / b > < / a > () const< / li >
< li class = fn > int < a href = "#numColumns" > < b > numColumns< / b > < / a > () const< / li >
< li class = fn > int < a href = "#numRows" > < b > numRows< / b > < / a > () const< / li >
< li class = fn > bool < a href = "#variableWidth" > < b > variableWidth< / b > < / a > () const< / li >
< li class = fn > virtual void < a href = "#setVariableWidth" > < b > setVariableWidth< / b > < / a > ( bool )< / li >
< li class = fn > bool < a href = "#variableHeight" > < b > variableHeight< / b > < / a > () const< / li >
< li class = fn > virtual void < a href = "#setVariableHeight" > < b > setVariableHeight< / b > < / a > ( bool )< / li >
< li class = fn > bool autoScrollBar () const < em > (obsolete)< / em > < / li >
< li class = fn > void setAutoScrollBar ( bool enable ) < em > (obsolete)< / em > < / li >
< li class = fn > bool scrollBar () const < em > (obsolete)< / em > < / li >
< li class = fn > void setScrollBar ( bool enable ) < em > (obsolete)< / em > < / li >
< li class = fn > bool autoBottomScrollBar () const < em > (obsolete)< / em > < / li >
< li class = fn > void setAutoBottomScrollBar ( bool enable ) < em > (obsolete)< / em > < / li >
< li class = fn > bool bottomScrollBar () const < em > (obsolete)< / em > < / li >
< li class = fn > void setBottomScrollBar ( bool enable ) < em > (obsolete)< / em > < / li >
< li class = fn > int inSort ( const TQListBoxItem * lbi ) < em > (obsolete)< / em > < / li >
< li class = fn > int inSort ( const TQString & text ) < em > (obsolete)< / em > < / li >
< li class = fn > int cellHeight ( int i ) const < em > (obsolete)< / em > < / li >
< li class = fn > int cellHeight () const < em > (obsolete)< / em > < / li >
< li class = fn > int cellWidth () const < em > (obsolete)< / em > < / li >
< li class = fn > int numCols () const < em > (obsolete)< / em > < / li >
< li class = fn > int < a href = "#itemHeight" > < b > itemHeight< / b > < / a > ( int index = 0 ) const< / li >
< li class = fn > TQListBoxItem * < a href = "#itemAt" > < b > itemAt< / b > < / a > ( const TQPoint & p ) const< / li >
< li class = fn > TQRect < a href = "#itemRect" > < b > itemRect< / b > < / a > ( TQListBoxItem * item ) const< / li >
< li class = fn > TQListBoxItem * < a href = "#firstItem" > < b > firstItem< / b > < / a > () const< / li >
< li class = fn > void < a href = "#sort" > < b > sort< / b > < / a > ( bool ascending = TRUE )< / li >
< / ul >
< h2 > Public Slots< / h2 >
< ul >
< li class = fn > void < a href = "#clear" > < b > clear< / b > < / a > ()< / li >
< li class = fn > virtual void < a href = "#ensureCurrentVisible" > < b > ensureCurrentVisible< / b > < / a > ()< / li >
< li class = fn > virtual void < a href = "#clearSelection" > < b > clearSelection< / b > < / a > ()< / li >
< li class = fn > virtual void < a href = "#selectAll" > < b > selectAll< / b > < / a > ( bool select )< / li >
< li class = fn > virtual void < a href = "#invertSelection" > < b > invertSelection< / b > < / a > ()< / li >
< / ul >
< h2 > Signals< / h2 >
< ul >
< li class = fn > void < a href = "#highlighted" > < b > highlighted< / b > < / a > ( int index )< / li >
< li class = fn > void < a href = "#selected" > < b > selected< / b > < / a > ( int index )< / li >
< li class = fn > void < a href = "#highlighted-2" > < b > highlighted< / b > < / a > ( const TQString & )< / li >
< li class = fn > void < a href = "#selected-2" > < b > selected< / b > < / a > ( const TQString & )< / li >
< li class = fn > void < a href = "#highlighted-3" > < b > highlighted< / b > < / a > ( TQListBoxItem * )< / li >
< li class = fn > void < a href = "#selected-3" > < b > selected< / b > < / a > ( TQListBoxItem * )< / li >
< li class = fn > void < a href = "#selectionChanged" > < b > selectionChanged< / b > < / a > ()< / li >
< li class = fn > void < a href = "#selectionChanged-2" > < b > selectionChanged< / b > < / a > ( TQListBoxItem * item )< / li >
< li class = fn > void < a href = "#currentChanged" > < b > currentChanged< / b > < / a > ( TQListBoxItem * item )< / li >
< li class = fn > void < a href = "#clicked" > < b > clicked< / b > < / a > ( TQListBoxItem * item )< / li >
< li class = fn > void < a href = "#clicked-2" > < b > clicked< / b > < / a > ( TQListBoxItem * item, const TQPoint & pnt )< / li >
< li class = fn > void < a href = "#pressed" > < b > pressed< / b > < / a > ( TQListBoxItem * item )< / li >
< li class = fn > void < a href = "#pressed-2" > < b > pressed< / b > < / a > ( TQListBoxItem * item, const TQPoint & pnt )< / li >
< li class = fn > void < a href = "#doubleClicked" > < b > doubleClicked< / b > < / a > ( TQListBoxItem * item )< / li >
< li class = fn > void < a href = "#returnPressed" > < b > returnPressed< / b > < / a > ( TQListBoxItem * )< / li >
< li class = fn > void < a href = "#rightButtonClicked" > < b > rightButtonClicked< / b > < / a > ( TQListBoxItem *, const TQPoint & )< / li >
< li class = fn > void < a href = "#rightButtonPressed" > < b > rightButtonPressed< / b > < / a > ( TQListBoxItem *, const TQPoint & )< / li >
< li class = fn > void < a href = "#mouseButtonPressed" > < b > mouseButtonPressed< / b > < / a > ( int button, TQListBoxItem * item, const TQPoint & pos )< / li >
< li class = fn > void < a href = "#mouseButtonClicked" > < b > mouseButtonClicked< / b > < / a > ( int button, TQListBoxItem * item, const TQPoint & pos )< / li >
< li class = fn > void < a href = "#contextMenuRequested" > < b > contextMenuRequested< / b > < / a > ( TQListBoxItem * item, const TQPoint & pos )< / li >
< li class = fn > void < a href = "#onItem" > < b > onItem< / b > < / a > ( TQListBoxItem * i )< / li >
< li class = fn > void < a href = "#onViewport" > < b > onViewport< / b > < / a > ()< / li >
< / ul >
< h2 > Properties< / h2 >
< ul >
< li class = fn > LayoutMode < a href = "#columnMode-prop" > < b > columnMode< / b > < / a > - the column layout mode for this list box< / li >
< li class = fn > uint < a href = "#count-prop" > < b > count< / b > < / a > - the number of items in the list box < em > (read only)< / em > < / li >
< li class = fn > int < a href = "#currentItem-prop" > < b > currentItem< / b > < / a > - the current highlighted item< / li >
< li class = fn > TQString < a href = "#currentText-prop" > < b > currentText< / b > < / a > - the text of the current item < em > (read only)< / em > < / li >
< li class = fn > bool multiSelection - whether or not the list box is in Multi selection mode < em > (obsolete)< / em > < / li >
< li class = fn > int < a href = "#numColumns-prop" > < b > numColumns< / b > < / a > - the number of columns in the list box < em > (read only)< / em > < / li >
< li class = fn > int < a href = "#numItemsVisible-prop" > < b > numItemsVisible< / b > < / a > - the number of visible items < em > (read only)< / em > < / li >
< li class = fn > int < a href = "#numRows-prop" > < b > numRows< / b > < / a > - the number of rows in the list box < em > (read only)< / em > < / li >
< li class = fn > LayoutMode < a href = "#rowMode-prop" > < b > rowMode< / b > < / a > - the row layout mode for this list box< / li >
< li class = fn > SelectionMode < a href = "#selectionMode-prop" > < b > selectionMode< / b > < / a > - the selection mode of the list box< / li >
< li class = fn > int < a href = "#topItem-prop" > < b > topItem< / b > < / a > - the index of an item at the top of the screen< / li >
< li class = fn > bool < a href = "#variableHeight-prop" > < b > variableHeight< / b > < / a > - whether this list box has variable-height rows< / li >
< li class = fn > bool < a href = "#variableWidth-prop" > < b > variableWidth< / b > < / a > - whether this list box has variable-width columns< / li >
< / ul >
< h2 > Protected Members< / h2 >
< ul >
< li class = fn > void < a href = "#updateItem" > < b > updateItem< / b > < / a > ( int index )< / li >
< li class = fn > void < a href = "#updateItem-2" > < b > updateItem< / b > < / a > ( TQListBoxItem * i )< / li >
< li class = fn > int totalWidth () const < em > (obsolete)< / em > < / li >
< li class = fn > int totalHeight () const < em > (obsolete)< / em > < / li >
< li class = fn > virtual void < a href = "#paintCell" > < b > paintCell< / b > < / a > ( TQPainter * p, int row, int col )< / li >
< li class = fn > void < a href = "#toggleCurrentItem" > < b > toggleCurrentItem< / b > < / a > ()< / li >
< li class = fn > bool < a href = "#isRubberSelecting" > < b > isRubberSelecting< / b > < / a > () const< / li >
< li class = fn > void < a href = "#doLayout" > < b > doLayout< / b > < / a > () const< / li >
< li class = fn > bool itemYPos ( int index, int * yPos ) const < em > (obsolete)< / em > < / li >
< li class = fn > int findItem ( int yPos ) const < em > (obsolete)< / em > < / li >
< / ul >
< hr > < a name = "details" > < / a > < h2 > Detailed Description< / h2 >
The TQListBox widget provides a list of selectable, read-only items.
< p >
< p > 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.
< p > TQListBox will add scroll bars as necessary, but it isn't intended
for < em > really< / em > 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 TQListBox may become slow with huge lists. (See
< a href = "ntqlistview.html" > TQListView< / a > and < a href = "ntqtable.html" > TQTable< / a > for possible alternatives.)
< p > There are a variety of selection modes described in the
TQListBox::SelectionMode documentation. The default is < a href = "#SelectionMode-enum" > Single< / a >
selection mode, but you can change it using < a href = "#setSelectionMode" > setSelectionMode< / a > ().
(< a href = "#setMultiSelection" > setMultiSelection< / a > () is still provided for compatibility with TQt
1.x. We recommend using setSelectionMode() in all code.)
< p > Because TQListBox offers multiple selection it must display
< a href = "focus.html#keyboard-focus" > keyboard focus< / a > and selection state separately. Therefore there are
functions both to set the selection state of an item, i.e.
< a href = "#setSelected" > setSelected< / a > (), and to set which item displays keyboard focus, i.e.
< a href = "#setCurrentItem" > setCurrentItem< / a > ().
< p > The list box normally arranges its items in a single column and
adds a vertical scroll bar if required. It is possible to have a
different fixed number of columns (< a href = "#setColumnMode" > setColumnMode< / a > ()), 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
(< a href = "#setRowMode" > setRowMode< / a > ()) or as many rows as will fit in the list box's
assigned screen space (setRowMode(FitToHeight)). In all these
cases TQListBox will add scroll bars, as appropriate, in at least
one direction.
< p > 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 < a href = "#setVariableHeight" > setVariableHeight< / a > (FALSE). The same
applies to a column's width, see < a href = "#setVariableWidth" > setVariableWidth< / a > ().
< p > The TQListBox's items are < a href = "qlistboxitem.html" > TQListBoxItem< / a > objects. TQListBox provides
methods to insert new items as strings, as pixmaps, and as
TQListBoxItem * (< a href = "#insertItem" > insertItem< / a > () with various arguments), and to
replace an existing item with a new string, pixmap or TQListBoxItem
(< a href = "#changeItem" > changeItem< / a > () with various arguments). You can also remove items
singly with < a href = "#removeItem" > removeItem< / a > () or < a href = "#clear" > clear< / a > () the entire list box. Note that
if you create a TQListBoxItem yourself and insert it, TQListBox
takes ownership of the item.
< p > You can also create a TQListBoxItem, such as < a href = "qlistboxtext.html" > TQListBoxText< / a > or
< a href = "qlistboxpixmap.html" > TQListBoxPixmap< / a > , 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.
< p > The list of items can be arbitrarily large; TQListBox will add
scroll bars if necessary. TQListBox can display a single-column
(the common case) or multiple-columns, and offers both single and
multiple selection. TQListBox does not support multiple-column
items (but < a href = "ntqlistview.html" > TQListView< / a > and < a href = "ntqtable.html" > TQTable< / a > do), or tree hierarchies (but
TQListView does).
< p > The list box items can be accessed both as < a href = "qlistboxitem.html" > TQListBoxItem< / a > objects
(recommended) and using integer indexes (the original TQListBox
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.
< p > Each item in a TQListBox contains a TQListBoxItem. One of the items
can be the current item. The < a href = "#currentChanged" > currentChanged< / a > () signal and the
< a href = "#highlighted" > highlighted< / a > () signal are emitted when a new item becomes current,
e.g. because the user clicks on it or < a href = "#setCurrentItem" > TQListBox::setCurrentItem< / a > ()
is called. The < a href = "#selected" > selected< / a > () signal is emitted when the user
double-clicks on an item or presses Enter on the current item.
< p > If the user does not select anything, no signals are emitted and
< a href = "#currentItem" > currentItem< / a > () returns -1.
< p > A list box has < a href = "tqwidget.html#FocusPolicy-enum" > WheelFocus< / a > as a default < a href = "tqwidget.html#focusPolicy" > focusPolicy< / a > (), i.e. it
can get keyboard focus by tabbing, clicking and through the use of
the mouse wheel.
< p > New items can be inserted using < a href = "#insertItem" > insertItem< / a > (), < a href = "#insertStrList" > insertStrList< / a > () or
< a href = "#insertStringList" > insertStringList< / a > (). < a href = "#inSort" > inSort< / a > () is obsolete because this method is
quite inefficient. It's preferable to insert the items normally
and call < a href = "#sort" > sort< / a > () afterwards, or to insert a sorted < a href = "ntqstringlist.html" > TQStringList< / a > ().
< p > By default, vertical and horizontal scroll bars are added and
removed as necessary. < a href = "ntqscrollview.html#setHScrollBarMode" > setHScrollBarMode< / a > () and < a href = "ntqscrollview.html#setVScrollBarMode" > setVScrollBarMode< / a > ()
can be used to change this policy.
< p > If you need to insert types other than strings and pixmaps, you
must define new classes which inherit < a href = "qlistboxitem.html" > TQListBoxItem< / a > .
< p > < b > Warning:< / b > The list box assumes ownership of all list box items and
will delete them when it does not need them any more.
< p > < img src = qlistbox-m.png > < img src = qlistbox-w.png >
< p > < p > See also < a href = "ntqlistview.html" > TQListView< / a > , < a href = "ntqcombobox.html" > TQComboBox< / a > , < a href = "ntqbuttongroup.html" > TQButtonGroup< / a > , < a href = "guibooks.html#fowler" > GUI Design Handbook: List Box (two
sections)< / a > , and < a href = "advanced.html" > Advanced Widgets< / a > .
< hr > < h2 > Member Type Documentation< / h2 >
< h3 class = fn > < a name = "LayoutMode-enum" > < / a > TQListBox::LayoutMode< / h3 >
< p > This enum type is used to specify how TQListBox lays out its rows
and columns.
< ul >
< li > < tt > TQListBox::FixedNumber< / tt > - There is a fixed number of rows (or columns).
< li > < tt > TQListBox::FitToWidth< / tt > - There are as many columns as will fit
on-screen.
< li > < tt > TQListBox::FitToHeight< / tt > - There are as many rows as will fit on-screen.
< li > < tt > TQListBox::Variable< / tt > - There are as many rows as are required by the
column mode. (Or as many columns as required by the row mode.)
< / ul > < p > Example: When you call < a href = "#setRowMode" > setRowMode< / a > ( FitToHeight ), < a href = "#columnMode" > columnMode< / a > ()
automatically becomes < a href = "#LayoutMode-enum" > Variable< / a > to accommodate the row mode
you've set.
< h3 class = fn > < a name = "SelectionMode-enum" > < / a > TQListBox::SelectionMode< / h3 >
< p > This enumerated type is used by TQListBox to indicate how it reacts
to selection by the user.
< ul >
< li > < tt > TQListBox::Single< / tt > - 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 < a href = "#clearSelection" > TQListBox::clearSelection< / a > ().
< li > < tt > TQListBox::Multi< / tt > - 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.
< li > < tt > TQListBox::Extended< / tt > - 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.
< li > < tt > TQListBox::NoSelection< / tt > - Items cannot be selected.
< / ul > < p > In other words, < a href = "#SelectionMode-enum" > Single< / a > is a real single-selection list box, < a href = "#SelectionMode-enum" > Multi< / a > is a real multi-selection list box, < a href = "#SelectionMode-enum" > Extended< / a > is a list
box in which users can select multiple items but usually want to
select either just one or a range of contiguous items, and < a href = "#SelectionMode-enum" > NoSelection< / a > is for a list box where the user can look but not
touch.
< hr > < h2 > Member Function Documentation< / h2 >
< h3 class = fn > < a name = "TQListBox" > < / a > TQListBox::TQListBox ( < a href = "tqwidget.html" > TQWidget< / a > * parent = 0, const char * name = 0, WFlags f = 0 )
< / h3 >
Constructs a new empty list box called < em > name< / em > and with parent < em > parent< / em > .
< p > Performance is boosted by modifying the widget flags < em > f< / em > so that
only part of the < a href = "qlistboxitem.html" > TQListBoxItem< / a > children is redrawn. This may be
unsuitable for custom TQListBoxItem classes, in which case < a href = "ntqt.html#WidgetFlags-enum" > WStaticContents< / a > and < a href = "ntqt.html#WidgetFlags-enum" > WNoAutoErase< / a > should be cleared
immediately after construction.
< p > < p > See also < a href = "tqwidget.html#clearWFlags" > TQWidget::clearWFlags< / a > () and < a href = "ntqt.html#WidgetFlags-enum" > TQt::WidgetFlags< / a > .
< h3 class = fn > < a name = "~TQListBox" > < / a > TQListBox::~TQListBox ()
< / h3 >
Destroys the list box. Deletes all list box items.
< h3 class = fn > bool < a name = "autoBottomScrollBar" > < / a > TQListBox::autoBottomScrollBar () const
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > Returns TRUE if < a href = "ntqscrollview.html#hScrollBarMode" > hScrollBarMode< / a > () is < a href = "ntqscrollview.html#ScrollBarMode-enum" > Auto< / a > ; otherwise returns
FALSE.
< h3 class = fn > bool < a name = "autoScrollBar" > < / a > TQListBox::autoScrollBar () const
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > Returns TRUE if < a href = "ntqscrollview.html#vScrollBarMode" > vScrollBarMode< / a > () is < a href = "ntqscrollview.html#ScrollBarMode-enum" > Auto< / a > ; otherwise returns
FALSE.
< h3 class = fn > bool < a name = "bottomScrollBar" > < / a > TQListBox::bottomScrollBar () const
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > Returns FALSE if < a href = "ntqscrollview.html#vScrollBarMode" > vScrollBarMode< / a > () is < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOff< / a > ; otherwise
returns TRUE.
< h3 class = fn > int < a name = "cellHeight" > < / a > TQListBox::cellHeight ( int i ) const
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p >
Returns the item height of item < em > i< / em > .
< p > See also < a href = "#itemHeight" > itemHeight< / a > ().
< h3 class = fn > int < a name = "cellHeight-2" > < / a > TQListBox::cellHeight () const
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Returns the item height of the first item, item 0.
< p > See also < a href = "#itemHeight" > itemHeight< / a > ().
< h3 class = fn > int < a name = "cellWidth" > < / a > TQListBox::cellWidth () const
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p >
Returns the maximum item width.
< p > See also < a href = "#maxItemWidth" > maxItemWidth< / a > ().
< h3 class = fn > void < a name = "centerCurrentItem" > < / a > TQListBox::centerCurrentItem ()
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > This function does exactly the same as < a href = "#ensureCurrentVisible" > ensureCurrentVisible< / a > ()
< p > < p > See also < a href = "#ensureCurrentVisible" > TQListBox::ensureCurrentVisible< / a > ().
< h3 class = fn > void < a name = "changeItem" > < / a > TQListBox::changeItem ( const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * lbi, int index )
< / h3 >
Replaces the item at position < em > index< / em > with < em > lbi< / em > . If < em > index< / em > is
negative or too large, < a href = "#changeItem" > changeItem< / a > () does nothing.
< p > The item that has been changed will become selected.
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#removeItem" > removeItem< / a > ().
< h3 class = fn > void < a name = "changeItem-2" > < / a > TQListBox::changeItem ( const < a href = "ntqstring.html" > TQString< / a > & text, int index )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Replaces the item at position < em > index< / em > with a new list box text
item with text < em > text< / em > .
< p > The operation is ignored if < em > index< / em > is out of range.
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#removeItem" > removeItem< / a > ().
< h3 class = fn > void < a name = "changeItem-3" > < / a > TQListBox::changeItem ( const < a href = "ntqpixmap.html" > TQPixmap< / a > & pixmap, int index )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Replaces the item at position < em > index< / em > with a new list box pixmap
item with pixmap < em > pixmap< / em > .
< p > The operation is ignored if < em > index< / em > is out of range.
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#removeItem" > removeItem< / a > ().
< h3 class = fn > void < a name = "changeItem-4" > < / a > TQListBox::changeItem ( const < a href = "ntqpixmap.html" > TQPixmap< / a > & pixmap, const < a href = "ntqstring.html" > TQString< / a > & text, int index )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Replaces the item at position < em > index< / em > with a new list box pixmap
item with pixmap < em > pixmap< / em > and text < em > text< / em > .
< p > The operation is ignored if < em > index< / em > is out of range.
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#removeItem" > removeItem< / a > ().
< h3 class = fn > void < a name = "clear" > < / a > TQListBox::clear ()< tt > [slot]< / tt >
< / h3 >
Deletes all the items in the list.
< p > < p > See also < a href = "#removeItem" > removeItem< / a > ().
< h3 class = fn > void < a name = "clearSelection" > < / a > TQListBox::clearSelection ()< tt > [virtual slot]< / tt >
< / h3 >
Deselects all items, if possible.
< p > Note that a < a href = "#SelectionMode-enum" > Single< / a > selection list box will automatically select
an item if it has < a href = "focus.html#keyboard-focus" > keyboard focus< / a > .
< p > Example: < a href = "listbox-example.html#x1432" > listbox/listbox.cpp< / a > .
< h3 class = fn > void < a name = "clicked" > < / a > TQListBox::clicked ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user clicks any mouse button. If
< em > item< / em > is not 0, the cursor is on < em > item< / em > . If < em > item< / em > is 0, the
mouse cursor isn't on any item.
< p > Note that you must not delete any < a href = "qlistboxitem.html" > TQListBoxItem< / a > objects in slots
connected to this signal.
< h3 class = fn > void < a name = "clicked-2" > < / a > TQListBox::clicked ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item, const < a href = "ntqpoint.html" > TQPoint< / a > & pnt )< tt > [signal]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > This signal is emitted when the user clicks any mouse button. If
< em > item< / em > is not 0, the cursor is on < em > item< / em > . If < em > item< / em > is 0, the
mouse cursor isn't on any item.
< p > < em > pnt< / em > is the position of the mouse cursor in the global
coordinate system (< a href = "qmouseevent.html#globalPos" > TQMouseEvent::globalPos< / a > ()). (If the click's
press and release differs by a pixel or two, < em > pnt< / em > is the
position at release time.)
< p > Note that you must not delete any < a href = "qlistboxitem.html" > TQListBoxItem< / a > objects in slots
connected to this signal.
< h3 class = fn > < a href = "ntqlistbox.html#LayoutMode-enum" > LayoutMode< / a > < a name = "columnMode" > < / a > TQListBox::columnMode () const
< / h3 > < p > Returns the column layout mode for this list box.
See the < a href = "ntqlistbox.html#columnMode-prop" > "columnMode"< / a > property for details.
< h3 class = fn > void < a name = "contextMenuRequested" > < / a > TQListBox::contextMenuRequested ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item, const < a href = "ntqpoint.html" > TQPoint< / a > & pos )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user invokes a context menu with
the right mouse button or with special system keys, with < em > item< / em >
being the item under the mouse cursor or the current item,
respectively.
< p > < em > pos< / em > is the position for the context menu in the global
coordinate system.
< h3 class = fn > uint < a name = "count" > < / a > TQListBox::count () const
< / h3 > < p > Returns the number of items in the list box.
See the < a href = "ntqlistbox.html#count-prop" > "count"< / a > property for details.
< h3 class = fn > void < a name = "currentChanged" > < / a > TQListBox::currentChanged ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user makes a new item the current
item. < em > item< / em > is the new current list box item.
< p > < p > See also < a href = "#currentItem-prop" > currentItem< / a > and < a href = "#currentItem-prop" > currentItem< / a > .
< h3 class = fn > int < a name = "currentItem" > < / a > TQListBox::currentItem () const
< / h3 > < p > Returns the current highlighted item.
See the < a href = "ntqlistbox.html#currentItem-prop" > "currentItem"< / a > property for details.
< h3 class = fn > < a href = "ntqstring.html" > TQString< / a > < a name = "currentText" > < / a > TQListBox::currentText () const
< / h3 > < p > Returns the text of the current item.
See the < a href = "ntqlistbox.html#currentText-prop" > "currentText"< / a > property for details.
< h3 class = fn > void < a name = "doLayout" > < / a > TQListBox::doLayout () const< tt > [protected]< / tt >
< / h3 >
This function does the hard layout work. You should never need to
call it.
< h3 class = fn > void < a name = "doubleClicked" > < / a > TQListBox::doubleClicked ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted whenever an item is double-clicked. It's
emitted on the second button press, not the second button release.
If < em > item< / em > is not 0, the cursor is on < em > item< / em > . If < em > item< / em > is 0,
the mouse cursor isn't on any item.
< h3 class = fn > void < a name = "ensureCurrentVisible" > < / a > TQListBox::ensureCurrentVisible ()< tt > [virtual slot]< / tt >
< / h3 >
Ensures that the current item is visible.
< h3 class = fn > < a href = "qlistboxitem.html" > TQListBoxItem< / a > * < a name = "findItem" > < / a > TQListBox::findItem ( const < a href = "ntqstring.html" > TQString< / a > & text, ComparisonFlags compare = BeginsWith ) const
< / h3 >
Finds the first list box item that has the text < em > text< / em > 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 < tt > ComparisonFlags< / tt > are specified in < em > compare< / em > then these flags
are used, otherwise the default is a case-insensitive, "begins
with" search.
< p > < p > See also < a href = "ntqt.html#StringComparisonMode-enum" > TQt::StringComparisonMode< / a > .
< h3 class = fn > int < a name = "findItem-2" > < / a > TQListBox::findItem ( int yPos ) const< tt > [protected]< / tt >
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p >
Returns the index of the item a point (0, < em > yPos< / em > ).
< p > See also < a href = "#index" > index< / a > () and < a href = "#itemAt" > itemAt< / a > ().
< h3 class = fn > < a href = "qlistboxitem.html" > TQListBoxItem< / a > * < a name = "firstItem" > < / a > TQListBox::firstItem () const
< / h3 >
Returns the first item in this list box. If the list box is empty,
returns 0.
< h3 class = fn > void < a name = "highlighted" > < / a > TQListBox::highlighted ( int index )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user makes a new item the current
item. < em > index< / em > is the index of the new current item.
< p > < p > See also < a href = "#currentChanged" > currentChanged< / a > (), < a href = "#selected" > selected< / a > (), < a href = "#currentItem-prop" > currentItem< / a > , and < a href = "#selectionChanged" > selectionChanged< / a > ().
< h3 class = fn > void < a name = "highlighted-2" > < / a > TQListBox::highlighted ( const < a href = "ntqstring.html" > TQString< / a > & )< tt > [signal]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > 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.
< p > < p > See also < a href = "#currentChanged" > currentChanged< / a > (), < a href = "#selected" > selected< / a > (), < a href = "#currentItem-prop" > currentItem< / a > , and < a href = "#selectionChanged" > selectionChanged< / a > ().
< h3 class = fn > void < a name = "highlighted-3" > < / a > TQListBox::highlighted ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * )< tt > [signal]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > This signal is emitted when the user makes a new item the current
item. The argument is a pointer to the new current item.
< p > < p > See also < a href = "#currentChanged" > currentChanged< / a > (), < a href = "#selected" > selected< / a > (), < a href = "#currentItem-prop" > currentItem< / a > , and < a href = "#selectionChanged" > selectionChanged< / a > ().
< h3 class = fn > int < a name = "inSort" > < / a > TQListBox::inSort ( const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * lbi )
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > Using this method is quite inefficient. We suggest to use < a href = "#insertItem" > insertItem< / a > ()
for inserting and < a href = "#sort" > sort< / a > () afterwards.
< p > Inserts < em > lbi< / em > at its sorted position in the list box and returns the
position.
< p > All items must be inserted with < a href = "#inSort" > inSort< / a > () to maintain the sorting
order. inSort() treats any pixmap (or user-defined type) as
lexicographically less than any string.
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#sort" > sort< / a > ().
< h3 class = fn > int < a name = "inSort-2" > < / a > TQListBox::inSort ( const < a href = "ntqstring.html" > TQString< / a > & text )
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Using this method is quite inefficient. We suggest to use < a href = "#insertItem" > insertItem< / a > ()
for inserting and < a href = "#sort" > sort< / a > () afterwards.
< p > Inserts a new item of < em > text< / em > at its sorted position in the list box and
returns the position.
< p > All items must be inserted with < a href = "#inSort" > inSort< / a > () to maintain the sorting
order. inSort() treats any pixmap (or user-defined type) as
lexicographically less than any string.
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#sort" > sort< / a > ().
< h3 class = fn > int < a name = "index" > < / a > TQListBox::index ( const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * lbi ) const
< / h3 >
Returns the index of < em > lbi< / em > , or -1 if the item is not in this list
box or < em > lbi< / em > is 0.
< p > < p > See also < a href = "#item" > item< / a > ().
< h3 class = fn > void < a name = "insertItem" > < / a > TQListBox::insertItem ( const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * lbi, int index = -1 )
< / h3 >
Inserts the item < em > lbi< / em > into the list at position < em > index< / em > .
< p > If < em > index< / em > is negative or larger than the number of items in the
list box, < em > lbi< / em > is inserted at the end of the list.
< p > < p > See also < a href = "#insertStrList" > insertStrList< / a > ().
< p > Examples: < a href = "i18n-example.html#x1925" > i18n/mywidget.cpp< / a > , < a href = "listbox-example.html#x1433" > listbox/listbox.cpp< / a > , < a href = "listboxcombo-example.html#x1406" > listboxcombo/listboxcombo.cpp< / a > , and < a href = "tabdialog-example.html#x55" > tabdialog/tabdialog.cpp< / a > .
< h3 class = fn > void < a name = "insertItem-2" > < / a > TQListBox::insertItem ( const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * lbi, const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * after )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Inserts the item < em > lbi< / em > into the list after the item < em > after< / em > , or
at the beginning if < em > after< / em > is 0.
< p > < p > See also < a href = "#insertStrList" > insertStrList< / a > ().
< h3 class = fn > void < a name = "insertItem-3" > < / a > TQListBox::insertItem ( const < a href = "ntqstring.html" > TQString< / a > & text, int index = -1 )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Inserts a new list box text item with the text < em > text< / em > into the
list at position < em > index< / em > .
< p > If < em > index< / em > is negative, < em > text< / em > is inserted at the end of the
list.
< p > < p > See also < a href = "#insertStrList" > insertStrList< / a > ().
< h3 class = fn > void < a name = "insertItem-4" > < / a > TQListBox::insertItem ( const < a href = "ntqpixmap.html" > TQPixmap< / a > & pixmap, int index = -1 )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Inserts a new list box pixmap item with the pixmap < em > pixmap< / em > into
the list at position < em > index< / em > .
< p > If < em > index< / em > is negative, < em > pixmap< / em > is inserted at the end of the
list.
< p > < p > See also < a href = "#insertStrList" > insertStrList< / a > ().
< h3 class = fn > void < a name = "insertItem-5" > < / a > TQListBox::insertItem ( const < a href = "ntqpixmap.html" > TQPixmap< / a > & pixmap, const < a href = "ntqstring.html" > TQString< / a > & text, int index = -1 )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Inserts a new list box pixmap item with the pixmap < em > pixmap< / em > and
the text < em > text< / em > into the list at position < em > index< / em > .
< p > If < em > index< / em > is negative, < em > pixmap< / em > is inserted at the end of the
list.
< p > < p > See also < a href = "#insertStrList" > insertStrList< / a > ().
< h3 class = fn > void < a name = "insertStrList" > < / a > TQListBox::insertStrList ( const < a href = "ntqstrlist.html" > TQStrList< / a > * list, int index = -1 )
< / h3 >
Inserts the string list < em > list< / em > into the list at position < em > index< / em > .
< p > If < em > index< / em > is negative, < em > list< / em > is inserted at the end of the
list. If < em > index< / em > is too large, the operation is ignored.
< p > < b > Warning:< / b > This function uses < tt > const char *< / tt > rather than < a href = "ntqstring.html" > TQString< / a > ,
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 < a href = "#insertStringList" > insertStringList< / a > () which uses real TQStrings.
< p > < b > Warning:< / b > This function is never significantly faster than a loop
around < a href = "#insertItem" > insertItem< / a > ().
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#insertStringList" > insertStringList< / a > ().
< h3 class = fn > void < a name = "insertStrList-2" > < / a > TQListBox::insertStrList ( const < a href = "ntqstrlist.html" > TQStrList< / a > & list, int index = -1 )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Inserts the string list < em > list< / em > into the list at position < em > index< / em > .
< p > If < em > index< / em > is negative, < em > list< / em > is inserted at the end of the
list. If < em > index< / em > is too large, the operation is ignored.
< p > < b > Warning:< / b > This function uses < tt > const char *< / tt > rather than < a href = "ntqstring.html" > TQString< / a > ,
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 < a href = "#insertStringList" > insertStringList< / a > () which uses real TQStrings.
< p > < b > Warning:< / b > This function is never significantly faster than a loop
around < a href = "#insertItem" > insertItem< / a > ().
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#insertStringList" > insertStringList< / a > ().
< h3 class = fn > void < a name = "insertStrList-3" > < / a > TQListBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Inserts the < em > numStrings< / em > strings of the array < em > strings< / em > into the
list at position < em > index< / em > .
< p > If < em > index< / em > is negative, < a href = "#insertStrList" > insertStrList< / a > () inserts < em > strings< / em > at the
end of the list. If < em > index< / em > is too large, the operation is
ignored.
< p > < b > Warning:< / b > This function uses < tt > const char *< / tt > rather than < a href = "ntqstring.html" > TQString< / a > ,
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 < a href = "#insertStringList" > insertStringList< / a > () which uses real TQStrings.
< p > < b > Warning:< / b > This function is never significantly faster than a loop
around < a href = "#insertItem" > insertItem< / a > ().
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#insertStringList" > insertStringList< / a > ().
< h3 class = fn > void < a name = "insertStringList" > < / a > TQListBox::insertStringList ( const < a href = "ntqstringlist.html" > TQStringList< / a > & list, int index = -1 )
< / h3 >
Inserts the string list < em > list< / em > into the list at position < em > index< / em > .
< p > If < em > index< / em > is negative, < em > list< / em > is inserted at the end of the
list. If < em > index< / em > is too large, the operation is ignored.
< p > < b > Warning:< / b > This function is never significantly faster than a loop
around < a href = "#insertItem" > insertItem< / a > ().
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#insertStrList" > insertStrList< / a > ().
< h3 class = fn > void < a name = "invertSelection" > < / a > TQListBox::invertSelection ()< tt > [virtual slot]< / tt >
< / h3 >
Inverts the selection. Only works in < a href = "#SelectionMode-enum" > Multi< / a > and < a href = "#SelectionMode-enum" > Extended< / a >
selection mode.
< h3 class = fn > bool < a name = "isMultiSelection" > < / a > TQListBox::isMultiSelection () const
< / h3 > < p > Returns TRUE if or not the list box is in Multi selection mode; otherwise returns FALSE.
See the < a href = "ntqlistbox.html#multiSelection-prop" > "multiSelection"< / a > property for details.
< h3 class = fn > bool < a name = "isRubberSelecting" > < / a > TQListBox::isRubberSelecting () const< tt > [protected]< / tt >
< / h3 >
Returns TRUE if the user is selecting items using a rubber band
rectangle; otherwise returns FALSE.
< h3 class = fn > bool < a name = "isSelected" > < / a > TQListBox::isSelected ( int i ) const
< / h3 >
Returns TRUE if item < em > i< / em > is selected; otherwise returns FALSE.
< h3 class = fn > bool < a name = "isSelected-2" > < / a > TQListBox::isSelected ( const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * i ) const
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Returns TRUE if item < em > i< / em > is selected; otherwise returns FALSE.
< h3 class = fn > < a href = "qlistboxitem.html" > TQListBoxItem< / a > * < a name = "item" > < / a > TQListBox::item ( int index ) const
< / h3 >
Returns a pointer to the item at position < em > index< / em > , or 0 if < em > index< / em > is out of bounds.
< p > < p > See also < a href = "#index" > index< / a > ().
< p > Example: < a href = "listboxcombo-example.html#x1407" > listboxcombo/listboxcombo.cpp< / a > .
< h3 class = fn > < a href = "qlistboxitem.html" > TQListBoxItem< / a > * < a name = "itemAt" > < / a > TQListBox::itemAt ( const < a href = "ntqpoint.html" > TQPoint< / a > & p ) const
< / h3 >
Returns the item at point < em > p< / em > , specified in viewport coordinates,
or a 0 if there is no item at < em > p< / em > .
< p > Use < a href = "ntqscrollview.html#contentsToViewport" > contentsToViewport< / a > () to convert between widget coordinates and
viewport coordinates.
< h3 class = fn > int < a name = "itemHeight" > < / a > TQListBox::itemHeight ( int index = 0 ) const
< / h3 >
Returns the height in pixels of the item with index < em > index< / em > . < em > index< / em > defaults to 0.
< p > If < em > index< / em > is too large, this function returns 0.
< h3 class = fn > < a href = "ntqrect.html" > TQRect< / a > < a name = "itemRect" > < / a > TQListBox::itemRect ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item ) const
< / h3 >
Returns the rectangle on the screen that < em > item< / em > occupies in
< a href = "ntqscrollview.html#viewport" > viewport< / a > ()'s coordinates, or an invalid rectangle if < em > item< / em > is 0
or is not currently visible.
< h3 class = fn > bool < a name = "itemVisible" > < / a > TQListBox::itemVisible ( int index )
< / h3 >
Returns TRUE if the item at position < em > index< / em > is at least partly
visible; otherwise returns FALSE.
< h3 class = fn > bool < a name = "itemVisible-2" > < / a > TQListBox::itemVisible ( const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Returns TRUE if < em > item< / em > is at least partly visible; otherwise
returns FALSE.
< h3 class = fn > bool < a name = "itemYPos" > < / a > TQListBox::itemYPos ( int index, int * yPos ) const< tt > [protected]< / tt >
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > Returns the vertical pixel-coordinate in < em > *yPos< / em > , of the list box
item at position < em > index< / em > in the list. Returns FALSE if the item is
outside the visible area.
< h3 class = fn > long < a name = "maxItemWidth" > < / a > TQListBox::maxItemWidth () const
< / h3 >
Returns the width of the widest item in the list box.
< h3 class = fn > void < a name = "mouseButtonClicked" > < / a > TQListBox::mouseButtonClicked ( int button, < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item, const < a href = "ntqpoint.html" > TQPoint< / a > & pos )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user clicks mouse button < em > button< / em > . If < em > item< / em > is not 0, the cursor is on < em > item< / em > . If < em > item< / em >
is 0, the mouse cursor isn't on any item.
< p > < em > pos< / em > is the position of the mouse cursor in the global
coordinate system (< a href = "qmouseevent.html#globalPos" > TQMouseEvent::globalPos< / a > ()). (If the click's
press and release differs by a pixel or two, < em > pos< / em > is the
position at release time.)
< p > Note that you must not delete any < a href = "qlistboxitem.html" > TQListBoxItem< / a > objects in slots
connected to this signal.
< h3 class = fn > void < a name = "mouseButtonPressed" > < / a > TQListBox::mouseButtonPressed ( int button, < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item, const < a href = "ntqpoint.html" > TQPoint< / a > & pos )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user presses mouse button < em > button< / em > . If < em > item< / em > is not 0, the cursor is on < em > item< / em > . If < em > item< / em >
is 0, the mouse cursor isn't on any item.
< p > < em > pos< / em > is the position of the mouse cursor in the global
coordinate system (< a href = "qmouseevent.html#globalPos" > TQMouseEvent::globalPos< / a > ()).
< p > Note that you must not delete any < a href = "qlistboxitem.html" > TQListBoxItem< / a > objects in slots
connected to this signal.
< h3 class = fn > int < a name = "numCols" > < / a > TQListBox::numCols () const
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p >
Returns the number of columns.
< p > See also < a href = "#numColumns-prop" > numColumns< / a > .
< h3 class = fn > int < a name = "numColumns" > < / a > TQListBox::numColumns () const
< / h3 > < p > Returns the number of columns in the list box.
See the < a href = "ntqlistbox.html#numColumns-prop" > "numColumns"< / a > property for details.
< h3 class = fn > int < a name = "numItemsVisible" > < / a > TQListBox::numItemsVisible () const
< / h3 > < p > Returns the number of visible items.
See the < a href = "ntqlistbox.html#numItemsVisible-prop" > "numItemsVisible"< / a > property for details.
< h3 class = fn > int < a name = "numRows" > < / a > TQListBox::numRows () const
< / h3 > < p > Returns the number of rows in the list box.
See the < a href = "ntqlistbox.html#numRows-prop" > "numRows"< / a > property for details.
< h3 class = fn > void < a name = "onItem" > < / a > TQListBox::onItem ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * i )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user moves the mouse cursor onto
an item, similar to the < a href = "tqwidget.html#enterEvent" > TQWidget::enterEvent< / a > () function. < em > i< / em > is
the < a href = "qlistboxitem.html" > TQListBoxItem< / a > that the mouse has moved on.
< h3 class = fn > void < a name = "onViewport" > < / a > TQListBox::onViewport ()< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user moves the mouse cursor from
an item to an empty part of the list box.
< h3 class = fn > void < a name = "paintCell" > < / a > TQListBox::paintCell ( < a href = "ntqpainter.html" > TQPainter< / a > * p, int row, int col )< tt > [virtual protected]< / tt >
< / h3 >
Provided for compatibility with the old TQListBox. We recommend
using < a href = "qlistboxitem.html#paint" > TQListBoxItem::paint< / a > () instead.
< p > Repaints the cell at < em > row< / em > , < em > col< / em > using painter < em > p< / em > .
< h3 class = fn > const < a href = "ntqpixmap.html" > TQPixmap< / a > * < a name = "pixmap" > < / a > TQListBox::pixmap ( int index ) const
< / h3 >
Returns a pointer to the pixmap at position < em > index< / em > , or 0 if
there is no pixmap there.
< p > < p > See also < a href = "#text" > text< / a > ().
< h3 class = fn > void < a name = "pressed" > < / a > TQListBox::pressed ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user presses any mouse button. If
< em > item< / em > is not 0, the cursor is on < em > item< / em > . If < em > item< / em > is 0, the
mouse cursor isn't on any item.
< p > Note that you must not delete any < a href = "qlistboxitem.html" > TQListBoxItem< / a > objects in slots
connected to this signal.
< h3 class = fn > void < a name = "pressed-2" > < / a > TQListBox::pressed ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item, const < a href = "ntqpoint.html" > TQPoint< / a > & pnt )< tt > [signal]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > This signal is emitted when the user presses any mouse button. If
< em > item< / em > is not 0, the cursor is on < em > item< / em > . If < em > item< / em > is 0, the
mouse cursor isn't on any item.
< p > < em > pnt< / em > is the position of the mouse cursor in the global
coordinate system (< a href = "qmouseevent.html#globalPos" > TQMouseEvent::globalPos< / a > ()).
< p > Note that you must not delete any < a href = "qlistboxitem.html" > TQListBoxItem< / a > objects in slots
connected to this signal.
< p > < p > See also < a href = "#mouseButtonPressed" > mouseButtonPressed< / a > (), < a href = "#rightButtonPressed" > rightButtonPressed< / a > (), and < a href = "#clicked" > clicked< / a > ().
< h3 class = fn > void < a name = "removeItem" > < / a > TQListBox::removeItem ( int index )
< / h3 >
Removes and deletes the item at position < em > index< / em > . If < em > index< / em > is
equal to < a href = "#currentItem" > currentItem< / a > (), a new item becomes current and the
< a href = "#currentChanged" > currentChanged< / a > () and < a href = "#highlighted" > highlighted< / a > () signals are emitted.
< p > < p > See also < a href = "#insertItem" > insertItem< / a > () and < a href = "#clear" > clear< / a > ().
< h3 class = fn > void < a name = "returnPressed" > < / a > TQListBox::returnPressed ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when Enter or Return is pressed. The
argument is < a href = "#currentItem" > currentItem< / a > ().
< h3 class = fn > void < a name = "rightButtonClicked" > < / a > TQListBox::rightButtonClicked ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > *, const < a href = "ntqpoint.html" > TQPoint< / a > & )< tt > [signal]< / tt >
< / h3 >
< p > 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 < a href = "qlistboxitem.html" > TQListBoxItem< / a > (may be 0) and the point
in global coordinates.
< h3 class = fn > void < a name = "rightButtonPressed" > < / a > TQListBox::rightButtonPressed ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > *, const < a href = "ntqpoint.html" > TQPoint< / a > & )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the right button is pressed. The
arguments are the relevant < a href = "qlistboxitem.html" > TQListBoxItem< / a > (may be 0) and the point
in global coordinates.
< h3 class = fn > < a href = "ntqlistbox.html#LayoutMode-enum" > LayoutMode< / a > < a name = "rowMode" > < / a > TQListBox::rowMode () const
< / h3 > < p > Returns the row layout mode for this list box.
See the < a href = "ntqlistbox.html#rowMode-prop" > "rowMode"< / a > property for details.
< h3 class = fn > bool < a name = "scrollBar" > < / a > TQListBox::scrollBar () const
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > Returns FALSE if < a href = "ntqscrollview.html#vScrollBarMode" > vScrollBarMode< / a > () is < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOff< / a > ; otherwise
returns TRUE.
< h3 class = fn > void < a name = "selectAll" > < / a > TQListBox::selectAll ( bool select )< tt > [virtual slot]< / tt >
< / h3 >
In < a href = "#SelectionMode-enum" > Multi< / a > and < a href = "#SelectionMode-enum" > Extended< / a > modes, this function sets all items to
be selected if < em > select< / em > is TRUE, and to be unselected if < em > select< / em > is FALSE.
< p > In < a href = "#SelectionMode-enum" > Single< / a > and < a href = "#SelectionMode-enum" > NoSelection< / a > modes, this function only changes
the selection status of < a href = "#currentItem" > currentItem< / a > ().
< h3 class = fn > void < a name = "selected" > < / a > TQListBox::selected ( int index )< tt > [signal]< / tt >
< / h3 >
< p > This signal is emitted when the user double-clicks on an item or
presses Enter on the current item. < em > index< / em > is the index of the
selected item.
< p > < p > See also < a href = "#currentChanged" > currentChanged< / a > (), < a href = "#highlighted" > highlighted< / a > (), and < a href = "#selectionChanged" > selectionChanged< / a > ().
< h3 class = fn > void < a name = "selected-2" > < / a > TQListBox::selected ( const < a href = "ntqstring.html" > TQString< / a > & )< tt > [signal]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > 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.
< p > < p > See also < a href = "#currentChanged" > currentChanged< / a > (), < a href = "#highlighted" > highlighted< / a > (), and < a href = "#selectionChanged" > selectionChanged< / a > ().
< h3 class = fn > void < a name = "selected-3" > < / a > TQListBox::selected ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * )< tt > [signal]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > 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.
< p > < p > See also < a href = "#currentChanged" > currentChanged< / a > (), < a href = "#highlighted" > highlighted< / a > (), and < a href = "#selectionChanged" > selectionChanged< / a > ().
< h3 class = fn > < a href = "qlistboxitem.html" > TQListBoxItem< / a > * < a name = "selectedItem" > < / a > TQListBox::selectedItem () const
< / h3 > Returns the selected item if the list box is in
single-selection mode and an item is selected.
< p > If no items are selected or the list box is in another selection mode
this function returns 0.
< p > < p > See also < a href = "#setSelected" > setSelected< / a > () and < a href = "#multiSelection-prop" > multiSelection< / a > .
< h3 class = fn > void < a name = "selectionChanged" > < / a > TQListBox::selectionChanged ()< tt > [signal]< / tt >
< / h3 >
< p > 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, TQListBox tries to emit
just one < a href = "#selectionChanged" > selectionChanged< / a > () signal so the signal can be connected
to computationally expensive slots.
< p > < p > See also < a href = "#selected" > selected< / a > () and < a href = "#currentItem-prop" > currentItem< / a > .
< h3 class = fn > void < a name = "selectionChanged-2" > < / a > TQListBox::selectionChanged ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item )< tt > [signal]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > This signal is emitted when the selection in a < a href = "#SelectionMode-enum" > Single< / a > selection
list box changes. < em > item< / em > is the newly selected list box item.
< p > < p > See also < a href = "#selected" > selected< / a > () and < a href = "#currentItem-prop" > currentItem< / a > .
< h3 class = fn > < a href = "ntqlistbox.html#SelectionMode-enum" > SelectionMode< / a > < a name = "selectionMode" > < / a > TQListBox::selectionMode () const
< / h3 > < p > Returns the selection mode of the list box.
See the < a href = "ntqlistbox.html#selectionMode-prop" > "selectionMode"< / a > property for details.
< h3 class = fn > void < a name = "setAutoBottomScrollBar" > < / a > TQListBox::setAutoBottomScrollBar ( bool enable )
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > If < em > enable< / em > is TRUE sets < a href = "ntqscrollview.html#setHScrollBarMode" > setHScrollBarMode< / a > () to < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOn< / a > ;
otherwise sets setHScrollBarMode() to < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOff< / a > .
< h3 class = fn > void < a name = "setAutoScrollBar" > < / a > TQListBox::setAutoScrollBar ( bool enable )
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > If < em > enable< / em > is TRUE sets < a href = "ntqscrollview.html#setVScrollBarMode" > setVScrollBarMode< / a > () to < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOn< / a > ;
otherwise sets setVScrollBarMode() to < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOff< / a > .
< h3 class = fn > void < a name = "setBottomItem" > < / a > TQListBox::setBottomItem ( int index )< tt > [virtual]< / tt >
< / h3 >
Scrolls the list box so the item at position < em > index< / em > in the list
is displayed in the bottom row of the list box.
< p > < p > See also < a href = "#topItem-prop" > topItem< / a > .
< h3 class = fn > void < a name = "setBottomScrollBar" > < / a > TQListBox::setBottomScrollBar ( bool enable )
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > If < em > enable< / em > is TRUE sets < a href = "ntqscrollview.html#setHScrollBarMode" > setHScrollBarMode< / a > () to < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOn< / a > ;
otherwise sets setHScrollBarMode() to < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOff< / a > .
< h3 class = fn > void < a name = "setColumnMode" > < / a > TQListBox::setColumnMode ( < a href = "ntqlistbox.html#LayoutMode-enum" > LayoutMode< / a > )< tt > [virtual]< / tt >
< / h3 > < p > Sets the column layout mode for this list box.
See the < a href = "ntqlistbox.html#columnMode-prop" > "columnMode"< / a > property for details.
< h3 class = fn > void < a name = "setColumnMode-2" > < / a > TQListBox::setColumnMode ( int )< tt > [virtual]< / tt >
< / h3 > < p > Sets the column layout mode for this list box.
See the < a href = "ntqlistbox.html#columnMode-prop" > "columnMode"< / a > property for details.
< h3 class = fn > void < a name = "setCurrentItem" > < / a > TQListBox::setCurrentItem ( int index )< tt > [virtual]< / tt >
< / h3 > < p > Sets the current highlighted item to < em > index< / em > .
See the < a href = "ntqlistbox.html#currentItem-prop" > "currentItem"< / a > property for details.
< h3 class = fn > void < a name = "setCurrentItem-2" > < / a > TQListBox::setCurrentItem ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * i )< tt > [virtual]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Sets the current item to the < a href = "qlistboxitem.html" > TQListBoxItem< / a > < em > i< / em > .
< h3 class = fn > void < a name = "setMultiSelection" > < / a > TQListBox::setMultiSelection ( bool multi )
< / h3 > < p > Sets whether or not the list box is in Multi selection mode to < em > multi< / em > .
See the < a href = "ntqlistbox.html#multiSelection-prop" > "multiSelection"< / a > property for details.
< h3 class = fn > void < a name = "setRowMode" > < / a > TQListBox::setRowMode ( < a href = "ntqlistbox.html#LayoutMode-enum" > LayoutMode< / a > )< tt > [virtual]< / tt >
< / h3 > < p > Sets the row layout mode for this list box.
See the < a href = "ntqlistbox.html#rowMode-prop" > "rowMode"< / a > property for details.
< h3 class = fn > void < a name = "setRowMode-2" > < / a > TQListBox::setRowMode ( int )< tt > [virtual]< / tt >
< / h3 > < p > Sets the row layout mode for this list box.
See the < a href = "ntqlistbox.html#rowMode-prop" > "rowMode"< / a > property for details.
< h3 class = fn > void < a name = "setScrollBar" > < / a > TQListBox::setScrollBar ( bool enable )
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > If < em > enable< / em > is TRUE sets < a href = "ntqscrollview.html#setVScrollBarMode" > setVScrollBarMode< / a > () to < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOn< / a > ;
otherwise sets setVScrollBarMode() to < a href = "ntqscrollview.html#ScrollBarMode-enum" > AlwaysOff< / a > .
< h3 class = fn > void < a name = "setSelected" > < / a > TQListBox::setSelected ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item, bool select )< tt > [virtual]< / tt >
< / h3 >
Selects < em > item< / em > if < em > select< / em > is TRUE or unselects it if < em > select< / em >
is FALSE, and repaints the item appropriately.
< p > If the list box is a < a href = "#SelectionMode-enum" > Single< / a > selection list box and < em > select< / em > is
TRUE, < a href = "#setSelected" > setSelected< / a > () calls < a href = "#setCurrentItem" > setCurrentItem< / a > ().
< p > If the list box is a < a href = "#SelectionMode-enum" > Single< / a > selection list box, < em > select< / em > is
FALSE, setSelected() calls < a href = "#clearSelection" > clearSelection< / a > ().
< p > < p > See also < a href = "#multiSelection-prop" > multiSelection< / a > , < a href = "#currentItem-prop" > currentItem< / a > , < a href = "#clearSelection" > clearSelection< / a > (), and < a href = "#currentItem-prop" > currentItem< / a > .
< h3 class = fn > void < a name = "setSelected-2" > < / a > TQListBox::setSelected ( int index, bool select )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > If < em > select< / em > is TRUE the item at position < em > index< / em > is selected;
otherwise the item is deselected.
< h3 class = fn > void < a name = "setSelectionMode" > < / a > TQListBox::setSelectionMode ( < a href = "ntqlistbox.html#SelectionMode-enum" > SelectionMode< / a > )< tt > [virtual]< / tt >
< / h3 > < p > Sets the selection mode of the list box.
See the < a href = "ntqlistbox.html#selectionMode-prop" > "selectionMode"< / a > property for details.
< h3 class = fn > void < a name = "setTopItem" > < / a > TQListBox::setTopItem ( int index )< tt > [virtual]< / tt >
< / h3 > < p > Sets the index of an item at the top of the screen to < em > index< / em > .
See the < a href = "ntqlistbox.html#topItem-prop" > "topItem"< / a > property for details.
< h3 class = fn > void < a name = "setVariableHeight" > < / a > TQListBox::setVariableHeight ( bool )< tt > [virtual]< / tt >
< / h3 > < p > Sets whether this list box has variable-height rows.
See the < a href = "ntqlistbox.html#variableHeight-prop" > "variableHeight"< / a > property for details.
< h3 class = fn > void < a name = "setVariableWidth" > < / a > TQListBox::setVariableWidth ( bool )< tt > [virtual]< / tt >
< / h3 > < p > Sets whether this list box has variable-width columns.
See the < a href = "ntqlistbox.html#variableWidth-prop" > "variableWidth"< / a > property for details.
< h3 class = fn > void < a name = "sort" > < / a > TQListBox::sort ( bool ascending = TRUE )
< / h3 >
If < em > ascending< / em > is TRUE sorts the items in ascending order;
otherwise sorts in descending order.
< p > To compare the items, the text (< a href = "qlistboxitem.html#text" > TQListBoxItem::text< / a > ()) of the items
is used.
< p > Example: < a href = "listbox-example.html#x1439" > listbox/listbox.cpp< / a > .
< h3 class = fn > void < a name = "takeItem" > < / a > TQListBox::takeItem ( const < a href = "qlistboxitem.html" > TQListBoxItem< / a > * item )
< / h3 >
Removes < em > item< / em > 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 < a href = "qlistboxitem.html#~TQListBoxItem" > TQListBoxItem::~TQListBoxItem< / a > ()
calls it. The normal way to delete an item is with < tt > delete< / tt > .
< p > < p > See also < a href = "#insertItem" > TQListBox::insertItem< / a > ().
< h3 class = fn > < a href = "ntqstring.html" > TQString< / a > < a name = "text" > < / a > TQListBox::text ( int index ) const
< / h3 >
Returns the text at position < em > index< / em > , or < a href = "ntqstring.html#TQString-null" > TQString::null< / a > if there
is no text at that position.
< p > < p > See also < a href = "#pixmap" > pixmap< / a > ().
< h3 class = fn > void < a name = "toggleCurrentItem" > < / a > TQListBox::toggleCurrentItem ()< tt > [protected]< / tt >
< / h3 >
Toggles the selection status of < a href = "#currentItem" > currentItem< / a > () and repaints if the
list box is a < a href = "#SelectionMode-enum" > Multi< / a > selection list box.
< p > < p > See also < a href = "#multiSelection-prop" > multiSelection< / a > .
< h3 class = fn > int < a name = "topItem" > < / a > TQListBox::topItem () const
< / h3 > < p > Returns the index of an item at the top of the screen.
See the < a href = "ntqlistbox.html#topItem-prop" > "topItem"< / a > property for details.
< h3 class = fn > int < a name = "totalHeight" > < / a > TQListBox::totalHeight () const< tt > [protected]< / tt >
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p >
Returns < a href = "ntqscrollview.html#contentsHeight" > contentsHeight< / a > ().
< h3 class = fn > int < a name = "totalWidth" > < / a > TQListBox::totalWidth () const< tt > [protected]< / tt >
< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p >
Returns < a href = "ntqscrollview.html#contentsWidth" > contentsWidth< / a > ().
< h3 class = fn > void < a name = "triggerUpdate" > < / a > TQListBox::triggerUpdate ( bool doLayout )
< / h3 >
Ensures that a single paint event will occur at the end of the
current event loop iteration. If < em > doLayout< / em > is TRUE, the layout
is also redone.
< h3 class = fn > void < a name = "updateItem" > < / a > TQListBox::updateItem ( int index )< tt > [protected]< / tt >
< / h3 >
Repaints the item at position < em > index< / em > in the list.
< h3 class = fn > void < a name = "updateItem-2" > < / a > TQListBox::updateItem ( < a href = "qlistboxitem.html" > TQListBoxItem< / a > * i )< tt > [protected]< / tt >
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Repaints the < a href = "qlistboxitem.html" > TQListBoxItem< / a > < em > i< / em > .
< h3 class = fn > bool < a name = "variableHeight" > < / a > TQListBox::variableHeight () const
< / h3 > < p > Returns TRUE if this list box has variable-height rows; otherwise returns FALSE.
See the < a href = "ntqlistbox.html#variableHeight-prop" > "variableHeight"< / a > property for details.
< h3 class = fn > bool < a name = "variableWidth" > < / a > TQListBox::variableWidth () const
< / h3 > < p > Returns TRUE if this list box has variable-width columns; otherwise returns FALSE.
See the < a href = "ntqlistbox.html#variableWidth-prop" > "variableWidth"< / a > property for details.
< hr > < h2 > Property Documentation< / h2 >
< h3 class = fn > < a href = "ntqlistbox.html#LayoutMode-enum" > LayoutMode< / a > < a name = "columnMode-prop" > < / a > columnMode< / h3 >
< p > This property holds the column layout mode for this list box.
< p > setColumnMode() sets the layout mode and adjusts the number of
displayed columns. The row layout mode automatically becomes < a href = "#LayoutMode-enum" > Variable< / a > , unless the column mode is < a href = "#LayoutMode-enum" > Variable< / a > .
< p > < p > See also < a href = "#rowMode-prop" > rowMode< / a > , < a href = "#rowMode-prop" > rowMode< / a > , and < a href = "#numColumns-prop" > numColumns< / a > .
< p > Set this property's value with < a href = "#setColumnMode" > setColumnMode< / a > () and get this property's value with < a href = "#columnMode" > columnMode< / a > ().
< h3 class = fn > uint < a name = "count-prop" > < / a > count< / h3 >
< p > This property holds the number of items in the list box.
< p >
< p > Get this property's value with < a href = "#count" > count< / a > ().
< h3 class = fn > int < a name = "currentItem-prop" > < / a > currentItem< / h3 >
< p > This property holds the current highlighted item.
< p > When setting this property, the highlighting is moved to the item
and the list box scrolled as necessary.
< p > If no item is current, < a href = "#currentItem" > currentItem< / a > () returns -1.
< p > Set this property's value with < a href = "#setCurrentItem" > setCurrentItem< / a > () and get this property's value with < a href = "#currentItem" > currentItem< / a > ().
< h3 class = fn > < a href = "ntqstring.html" > TQString< / a > < a name = "currentText-prop" > < / a > currentText< / h3 >
< p > This property holds the text of the current item.
< p > This is equivalent to < a href = "#text" > text< / a > (currentItem()).
< p > Get this property's value with < a href = "#currentText" > currentText< / a > ().
< h3 class = fn > bool < a name = "multiSelection-prop" > < / a > multiSelection< / h3 >
< b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > < p > This property holds whether or not the list box is in Multi selection mode.
< p > Consider using the < a href = "#selectionMode-prop" > TQListBox::selectionMode< / a > property instead of
this property.
< p > When setting this property, Multi selection mode is used if set to TRUE and
to Single selection mode if set to FALSE.
< p > 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.
< p > < p > See also < a href = "#selectionMode-prop" > selectionMode< / a > .
< p > Set this property's value with < a href = "#setMultiSelection" > setMultiSelection< / a > () and get this property's value with < a href = "#isMultiSelection" > isMultiSelection< / a > ().
< h3 class = fn > int < a name = "numColumns-prop" > < / a > numColumns< / h3 >
< p > This property holds the number of columns in the list box.
< p > This is normally 1, but can be different if < a href = "#columnMode-prop" > TQListBox::columnMode< / a > or < a href = "#rowMode-prop" > TQListBox::rowMode< / a > has been set.
< p > < p > See also < a href = "#columnMode-prop" > columnMode< / a > , < a href = "#rowMode-prop" > rowMode< / a > , and < a href = "#numRows-prop" > numRows< / a > .
< p > Get this property's value with < a href = "#numColumns" > numColumns< / a > ().
< h3 class = fn > int < a name = "numItemsVisible-prop" > < / a > numItemsVisible< / h3 >
< p > This property holds the number of visible items.
< p > Both partially and entirely visible items are counted.
< p > Get this property's value with < a href = "#numItemsVisible" > numItemsVisible< / a > ().
< h3 class = fn > int < a name = "numRows-prop" > < / a > numRows< / h3 >
< p > This property holds the number of rows in the list box.
< p > This is equal to the number of items in the default single-column
layout, but can be different.
< p > < p > See also < a href = "#columnMode-prop" > columnMode< / a > , < a href = "#rowMode-prop" > rowMode< / a > , and < a href = "#numColumns-prop" > numColumns< / a > .
< p > Get this property's value with < a href = "#numRows" > numRows< / a > ().
< h3 class = fn > < a href = "ntqlistbox.html#LayoutMode-enum" > LayoutMode< / a > < a name = "rowMode-prop" > < / a > rowMode< / h3 >
< p > This property holds the row layout mode for this list box.
< p > This property is normally < a href = "#LayoutMode-enum" > Variable< / a > .
< p > < a href = "#setRowMode" > setRowMode< / a > () sets the layout mode and adjusts the number of
displayed rows. The column layout mode automatically becomes < a href = "#LayoutMode-enum" > Variable< / a > , unless the row mode is < a href = "#LayoutMode-enum" > Variable< / a > .
< p > < p > See also < a href = "#columnMode-prop" > columnMode< / a > .
< p > Set this property's value with < a href = "#setRowMode" > setRowMode< / a > () and get this property's value with < a href = "#rowMode" > rowMode< / a > ().
< h3 class = fn > < a href = "ntqlistbox.html#SelectionMode-enum" > SelectionMode< / a > < a name = "selectionMode-prop" > < / a > selectionMode< / h3 >
< p > This property holds the selection mode of the list box.
< p > Sets the list box's selection mode, which may be one of < a href = "#SelectionMode-enum" > Single< / a >
(the default), < a href = "#SelectionMode-enum" > Extended< / a > , < a href = "#SelectionMode-enum" > Multi< / a > or < a href = "#SelectionMode-enum" > NoSelection< / a > .
< p > < p > See also < a href = "#SelectionMode-enum" > SelectionMode< / a > .
< p > Set this property's value with < a href = "#setSelectionMode" > setSelectionMode< / a > () and get this property's value with < a href = "#selectionMode" > selectionMode< / a > ().
< h3 class = fn > int < a name = "topItem-prop" > < / a > topItem< / h3 >
< p > This property holds the index of an item at the top of the screen.
< p > When getting this property and the listbox has multiple columns,
an arbitrary item is selected and returned.
< p > When setting this property, the list box is scrolled so the item
at position < em > index< / em > in the list is displayed in the top row of
the list box.
< p > Set this property's value with < a href = "#setTopItem" > setTopItem< / a > () and get this property's value with < a href = "#topItem" > topItem< / a > ().
< h3 class = fn > bool < a name = "variableHeight-prop" > < / a > variableHeight< / h3 >
< p > This property holds whether this list box has variable-height rows.
< p > 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.
< p > < p > See also < a href = "#variableWidth-prop" > variableWidth< / a > .
< p > Set this property's value with < a href = "#setVariableHeight" > setVariableHeight< / a > () and get this property's value with < a href = "#variableHeight" > variableHeight< / a > ().
< h3 class = fn > bool < a name = "variableWidth-prop" > < / a > variableWidth< / h3 >
< p > This property holds whether this list box has variable-width columns.
< p > 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.
< p > < p > See also < a href = "#variableHeight-prop" > variableHeight< / a > .
< p > Set this property's value with < a href = "#setVariableWidth" > setVariableWidth< / a > () and get this property's value with < a href = "#variableWidth" > variableWidth< / a > ().
<!-- eof -->
< hr > < p >
This file is part of the < a href = "index.html" > TQt toolkit< / a > .
Copyright © 1995-2007
< a href = "http://www.trolltech.com/" > Trolltech< / a > . All Rights Reserved.< p > < address > < hr > < div align = center >
< table width = 100% cellspacing = 0 border = 0 > < tr >
< td > Copyright © 2007
< a href = "troll.html" > Trolltech< / a > < td align = center > < a href = "trademarks.html" > Trademarks< / a >
< td align = right > < div align = right > TQt 3.3.8< / div >
< / table > < / div > < / address > < / body >
< / html >