📄 qlistbox.3qt
字号:
Returns TRUE if item \fIi\fR is selected. Returns FALSE if it is not selected or if there is an error..SH "bool QListBox::isSelected ( int i ) const"Returns TRUE if item \fIi\fR is selected. Returns FALSE if it is not selected or if there is an error..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..PPSee also index()..SH "QListBoxItem * QListBox::itemAt ( QPoint p ) const"Returns a pointer to the item at \fIp,\fR which is in on-screen coordinates, or a null pointer if there is no item at \fIp.\fR.SH "int QListBox::itemHeight ( int index = 0 ) const"Returns the height in pixels of the item with index \fIindex. index\fR defaults to 0..PPIf \fIindex\fR is too large, this function returns 0..SH "QRect QListBox::itemRect ( QListBoxItem * item ) const"Returns the rectangle on the screen \fIitem\fR occupies in viewport()'s coordinates, or an invalid rectangle if \fIi\fR is a null pointer or is not currently visible..SH "bool QListBox::itemVisible ( const QListBoxItem * item )"Returns TRUE if \fIitem\fR is at least partly visible, or else FALSE..SH "bool QListBox::itemVisible ( int index )"Returns TRUE if the item at position \fIindex\fR is at least partly visible..SH "void QListBox::keyPressEvent ( QKeyEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "long QListBox::maxItemWidth () const"Returns the width of the largest item in the listbox..SH "QSize QListBox::minimumSizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QListBox::mouseButtonClicked ( int button, QListBoxItem * item, const QPoint & pos ) \fC[signal]\fR"This signal is emitted whenever the user clicks (mouse pressed + mouse released) into the listbox. \fIbutton\fR is the mouse button, which the user pressed. \fIitem\fR is the pointer to the clicked listbox item or NULL, if the user didn't click on an item. \fIpos\fR is the position where the user has clicked..PPNote that you may 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 whenever the user presses the mouse button on a listbox. \fIbutton\fR is the mouse button, which the user pressed. \fIitem\fR is the pointer to the listbox item onto which the user pressed the mouse button or NULL, if the user didn't press the mouse on an item. \fIpos\fR is the position of the mouse cursor where the mouse cursor was when the user pressed the mouse button..PPNote that you may not delete any QListBoxItem objects in slots connected to this signal..SH "void QListBox::mouseDoubleClickEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QListBox::mouseMoveEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QListBox::mousePressEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QListBox::mouseReleaseEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "int QListBox::numColumns () const"Returns the number of columns in the list box. This is normally 1, but can be different if setColumnMode() or setRowMode() has been called..PPSee also setColumnMode(), setRowMode() and numRows()..SH "int QListBox::numItemsVisible () const"Returns the number of visible items. Both partially and entirely visible items are counted..SH "int QListBox::numRows () const"Returns the number of rows in the list box. This is equal to the number of items in the default single-column layout, but can be different..PPSee also setRowMode() and numColumns()..SH "void QListBox::onItem ( QListBoxItem * i ) \fC[signal]\fR"This signal is emitted, when the user moves the mouse cursor onto an item. It磗 only emitted once per item..SH "void QListBox::onViewport () \fC[signal]\fR"This signal is emitted, when the user moves the mouse cursor, which was on an item away from the item onto the viewport..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()..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..PPSee also text()..SH "void QListBox::pressed ( QListBoxItem * item ) \fC[signal]\fR"This signal is emitted whenever the user presses the mouse button on a listbox. \fIitem\fR is the pointer to the listbox item onto which the user pressed the mouse button or NULL, if the user didn't press the mouse on an item..PPNote that you may not delete any QListBoxItem objects in slots connected to this signal..SH "void QListBox::pressed ( QListBoxItem * item, const QPoint & pnt ) \fC[signal]\fR"This signal is emitted whenever the user presses the mouse button on a listbox. \fIitem\fR is the pointer to the listbox item onto which the user pressed the mouse button or NULL, if the user didn't press the mouse on an item. \fIpnt\fR is the position of the mouse cursor where the mouse cursor was when the user pressed the mouse button..PPNote that you may not delete any QListBoxItem objects in slots connected to this signal..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 gets highlighted and the highlighted() signal is emitted..PPSee also insertItem() and clear()..SH "void QListBox::resizeEvent ( QResizeEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..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 (ie. when it's released). 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. Then arguments are the relevant QListBoxItem (may be 0) and the point in global coordinates..SH "QListBox::LayoutMode QListBox::rowMode() const"Returns the row layout mode for this list box. This is normally \fCVariable,\fR but can be changed by calling setRowMode()..PPSee also columnMode(), setRowMode() and numRows()..SH "void QListBox::selectAll ( bool select ) \fC[slot]\fR"If \fIselect\fR is TRUE, all items get selected, else all get unselected. This works only in the selection modes Multi and Extended. In Single and NoSelection mode the selection of the current item is just set to \fIselect.\fR.SH "void QListBox::selected ( QListBoxItem * ) \fC[signal]\fR"This signal is emitted when the user double-clicks on an item or presses return when an item is highlighted. The argument is a pointer to the new selected item..PPSee also highlighted() and selectionChanged()..SH "void QListBox::selected ( const QString & ) \fC[signal]\fR"This signal is emitted when the user double-clicks on an item or presses return while an item is highlighted, and the selected item is (or has) a string. The argument is the text of the selected item..PPSee also highlighted() and selectionChanged()..SH "void QListBox::selected ( int index ) \fC[signal]\fR"This signal is emitted when the user double-clicks on an item or presses return when an item is highlighted. The argument is the index of the selected item..PPSee also highlighted() and selectionChanged()..SH "void QListBox::selectionChanged () \fC[signal]\fR"This signal is emitted when the selection set of a listbox 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..PPSee also selected() and currentItem()..SH "void QListBox::selectionChanged ( QListBoxItem * item ) \fC[signal]\fR"This signal is emitted when the selection in a single-selection listbox changes. \fIitem\fR is the new selected listbox item..PPSee also selected() and currentItem()..SH "QListBox::SelectionMode QListBox::selectionMode() const"Returns the selection mode of the list box. The initial mode is \fCSingle.\fR.PPSee also setSelectionMode()..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..PPSee also setTopItem()..SH "void QListBox::setColumnMode ( LayoutMode mode )"Sets the column layout mode to \fImode,\fR and the number of displayed columns accordingly..PPThe row layout mode implicitly becomes \fCVariable.\fR.PPIf \fImode\fR is \fCVariable,\fR this function returns without doing anything..PPSee also setRowMode() and columnMode()..SH "void QListBox::setColumnMode ( int columns ) \fC[virtual]\fR"Sets the column layout mode for this list box to \fCFixedNumber,\fR and sets the number of displayed columns accordingly..PPSee also setRowMode(), columnMode() and numColumns()..SH "void QListBox::setCurrentItem ( QListBoxItem * i ) \fC[virtual]\fR"Sets the highlighted item to the item \fIi.\fR The highlighting is moved and the list box scrolled as necessary..PPSee also currentItem()..SH "void QListBox::setCurrentItem ( int index ) \fC[virtual]\fR"This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts..PPThis is a bit slower than the QListBoxItem * version..SH "void QListBox::setFont ( const QFont & font ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..SH "void QListBox::setMultiSelection ( bool enable )"\fBThis function is obsolete.\fR It is provided to keep old source working, and will probably be removed in a future version of Qt. We strongly advise against using it in new code..PPConsider using setSelectionMode() instead of this method..PPSets the list box to multi-selection mode if \fIenable\fR is TRUE, and to single-selection mode if \fIenable\fR is FALSE. We recommend using setSelectionMode() instead; that function also offers two other modes..PPSee also setSelectionMode() and selectionMode()..SH "void QListBox::setRowMode ( LayoutMode mode )"Sets the row layout mode to \fImode,\fR and the number of displayed rows accordingly..PPThe column layout mode implicitly becomes \fCVariable.\fR.PPIf \fImode\fR is \fCVariable,\fR this function returns without doing anything..PPSee also setColumnMode() and rowMode()..SH "void QListBox::setRowMode ( int rows ) \fC[virtual]\fR"Sets the row layout mode for this list box to \fCFixedNumber\fR and sets the number of displayed rows accordingly..PPSee also setColumnMode(), rowMode() and numRows()..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..PPIf the listbox is a single-selection listbox and and \fIselect\fR is TRUE, setCurrentItem() is called..PPIf the listbox is a single-selection listbox and and \fIselect\fR is FALSE, clearSelection() is called if \fIindex\fR is the currently selected item..PPNote that for this function, no-selection means multi-selection. The user cannot select items in a no-selection list box, but the application programmer can..PPSee also setMultiSelection(), setCurrentItem(), clearSelection() and currentItem()..SH "void QListBox::setSelected ( int index, bool select )"Selects the item at position \fIindex\fR if \fIselect\fR is TRUE, or unselects it if \fIselect\fR is FALSE, and repaints the item appropriately..PPIf the listbox is a single-selection listbox and and \fIselect\fR is TRUE, setCurrentItem() will be called..PPIf the listbox is a single-selection listbox and and \fIselect\fR is FALSE, clearSelection() will be called if \fIindex\fR is the currently selected item..PPSee also setMultiSelection(), setCurrentItem(), clearSelection() and currentItem()..SH "void QListBox::setSelectionMode ( SelectionMode mode )"Sets the list box to selection mode \fImode,\fR which may be one of \fCSingle\fR (the default), \fCExtended, Multi\fR or \fCNoSelection.\fR.PPSee also selectionMode()..SH "void QListBox::setTopItem ( int index ) \fC[virtual]\fR"Scrolls the list box so the item at position \fIindex\fR in the list is displayed in the top row of the list box..PPSee also topItem() and ensureCurrentVisible()..SH "void QListBox::setVariableHeight ( bool enable ) \fC[virtual]\fR"Sets this list box to have variable-height rows if \fIenable\fR is TRUE, and equal-height rows if \fIenable\fR is FALSE..PPWhen the list box has variable-height rows, 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..PPThe default is TRUE..PPSee also setVariableWidth() and variableHeight()..SH "void QListBox::setVariableWidth ( bool enable ) \fC[virtual]\fR"Sets this list box to have variable-width columns if \fIenable\fR is TRUE, and equal-width columns if \fIenable\fR is FALSE..PPWhen 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, all columns are as wide as the widest item in the list box..PPThe default is FALSE..PPSee also setVariableHeight() and variableWidth()..SH "void QListBox::showEvent ( QShowEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QSize QListBox::sizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QListBox::sort ( bool ascending = TRUE )"Sorts the item in ascending order, if \fIascending\fR is TRUE, or descending otherwise..PPTo compare the items, the text (QListBoxItem::text()) of the items is used. The sorting is done using the Quick-Sort Alogorithm..SH "void QListBox::takeItem ( const QListBoxItem * item )"Removes \fIitem\fR from the listbox and causes an update of the screen display. The item is not deleted. You should normally not need to call this function, as QListBoxItem::~QListBoxItem() calls it. The normal way to delete an item is \fCdelete.\fR.PPSee also QListBox::insertItem()..SH "QString QListBox::text ( int index ) const"Returns the text at position \fIindex,\fR or a null string if there is no text at that position..PPSee also pixmap()..SH "void QListBox::toggleCurrentItem () \fC[protected]\fR"Toggles the selection status of currentItem() and repaints, if the listbox is a multi-selection listbox..PPSee also setMultiSelection()..SH "int QListBox::topItem () const"Returns the index of an item at the top of the screen. If there are more than one of them, an arbitrary item is selected and returned..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 ( QListBoxItem * i ) \fC[protected]\fR"Repaints \fIi.\fR.SH "void QListBox::updateItem ( int index ) \fC[protected]\fR"Repaints the item at position \fIindex\fR in the list..SH "bool QListBox::variableHeight () const"Returns TRUE if this list box has variable-height rows, and FALSE if all the rows have the same height..PPSee also setVariableHeight() and setVariableWidth()..SH "bool QListBox::variableWidth () const"Returns TRUE if this list box has variable-width columns, and FALSE if all the columns have the same width..PPSee also setVariableHeight() and setVariableWidth()..SH "void QListBox::viewportMouseDoubleClickEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QScrollView..SH "void QListBox::viewportMouseMoveEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QScrollView..SH "void QListBox::viewportMousePressEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QScrollView..SH "void QListBox::viewportMouseReleaseEvent ( QMouseEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QScrollView..SH "void QListBox::viewportPaintEvent ( QPaintEvent * e ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QScrollView..SH "void QListBox::clearInputString () \fC[protected slot]\fR"For internal use only..SH "SEE ALSO".BR http://doc.trolltech.com/qlistbox.html.SH COPYRIGHTCopyright 1992-2000 Trolltech AS, http://www.trolltech.com/. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -