📄 qlistbox.3qt
字号:
This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReplaces the item at position \fIindex\fR with a new list box pixmap item with pixmap \fIpixmap\fR and text \fItext\fR..PPThe operation is ignored if \fIindex\fR is out of range..PPSee also insertItem() and removeItem()..SH "void QListBox::clear ()\fC [slot]\fR"Deletes all the items in the list..PPSee also removeItem()..SH "void QListBox::clearSelection ()\fC [virtual slot]\fR"Deselects all items, if possible..PPNote that a Single selection list box will automatically select an item if it has keyboard focus..PPExample: listbox/listbox.cpp..SH "void QListBox::clicked ( QListBoxItem * item )\fC [signal]\fR"This signal is emitted when the user clicks any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item..PPNote that you must not delete any QListBoxItem objects in slots connected to this signal..SH "void QListBox::clicked ( QListBoxItem * item, const QPoint & pnt )\fC [signal]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThis signal is emitted when the user clicks any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item..PP\fIpnt\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differs by a pixel or two, \fIpnt\fR is the position at release time.).PPNote that you must not delete any QListBoxItem objects in slots connected to this signal..SH "LayoutMode QListBox::columnMode () const"Returns the column layout mode for this list box. See the "columnMode" property for details..SH "void QListBox::contextMenuRequested ( QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"This signal is emitted when the user invokes a context menu with the right mouse button or with special system keys, with \fIitem\fR being the item under the mouse cursor or the current item, respectively..PP\fIpos\fR is the position for the context menu in the global coordinate system..SH "uint QListBox::count () const"Returns the number of items in the list box. See the "count" property for details..SH "void QListBox::currentChanged ( QListBoxItem * item )\fC [signal]\fR"This signal is emitted when the user highlights a new current item. \fIitem\fR is the new current list box item..PPSee also currentItem and currentItem..SH "int QListBox::currentItem () const"Returns the current highlighted item. See the "currentItem" property for details..SH "QString QListBox::currentText () const"Returns the text of the current item. See the "currentText" property for details..SH "void QListBox::doLayout () const\fC [protected]\fR"This function does the hard layout work. You should never need to call it..SH "void QListBox::doubleClicked ( QListBoxItem * item )\fC [signal]\fR"This signal is emitted whenever an item is double-clicked. It's emitted on the second button press, not the second button release. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item..SH "void QListBox::ensureCurrentVisible ()\fC [virtual slot]\fR"Ensures that the current item is visible..SH "QListBoxItem * QListBox::findItem ( const QString & text, ComparisonFlags compare = BeginsWith ) const"Finds the first list box item that has the text \fItext\fR and returns it, or returns 0 of no such item could be found. If \fCComparisonFlags\fR are specified in \fIcompare\fR then these flags are used, otherwise the default is a case-insensitive, "begins with" search..PPSee also Qt::StringComparisonMode..SH "int QListBox::findItem ( int yPos ) const\fC [protected]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPReturns the index of the item a point (0, \fIyPos\fR)..PPSee also index() and itemAt()..SH "QListBoxItem * QListBox::firstItem () const"Returns the first item in this list box. If the list box is empty, returns 0..SH "void QListBox::highlighted ( int index )\fC [signal]\fR"This signal is emitted when the user highlights a new current item. \fIindex\fR is the index of the highlighted item..PPSee also selected(), currentItem, and selectionChanged()..SH "void QListBox::highlighted ( const QString & )\fC [signal]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThis signal is emitted when the user highlights a new current item and the new item is a string. The argument is the text of the new current item..PPSee also selected(), currentItem, and selectionChanged()..SH "void QListBox::highlighted ( QListBoxItem * )\fC [signal]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThis signal is emitted when the user highlights a new current item. The argument is a pointer to the new current item..PPSee also selected(), currentItem, and selectionChanged()..SH "int QListBox::inSort ( const QListBoxItem * lbi )"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPUsing this method is quite inefficient. We suggest to use insertItem() for inserting and sort() afterwards..PPInserts \fIlbi\fR at its sorted position in the list box and returns the position..PPAll items must be inserted with inSort() to maintain the sorting order. inSort() treats any pixmap (or user-defined type) as lexicographically less than any string..PPSee also insertItem() and sort()..SH "int QListBox::inSort ( const QString & text )"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPThis is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPUsing this method is quite inefficient. We suggest to use insertItem() for inserting and sort() afterwards..PPInserts a new item of \fItext\fR at its sorted position in the list box and returns the position..PPAll items must be inserted with inSort() to maintain the sorting order. inSort() treats any pixmap (or user-defined type) as lexicographically less than any string..PPSee also insertItem() and sort()..SH "int QListBox::index ( const QListBoxItem * lbi ) const"Returns the index of \fIlbi\fR, or -1 if the item is not in this list box or \fIlbi\fR is 0..PPSee also item()..SH "void QListBox::insertItem ( const QListBoxItem * lbi, int index = -1 )"Inserts the item \fIlbi\fR into the list at position \fIindex\fR..PPIf \fIindex\fR is negative or larger than the number of items in the list box, \fIlbi\fR is inserted at the end of the list..PPSee also insertStrList()..PPExamples:.)l i18n/mywidget.cpp, listbox/listbox.cpp, listboxcombo/listboxcombo.cpp, and tabdialog/tabdialog.cpp..SH "void QListBox::insertItem ( const QListBoxItem * lbi, const QListBoxItem * after )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts the item \fIlbi\fR into the list after the item \fIafter\fR, or at the beginning if \fIafter\fR is 0..PPSee also insertStrList()..SH "void QListBox::insertItem ( const QString & text, int index = -1 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts a new list box text item with the text \fItext\fR into the list at position \fIindex\fR..PPIf \fIindex\fR is negative, \fItext\fR is inserted at the end of the list..PPSee also insertStrList()..SH "void QListBox::insertItem ( const QPixmap & pixmap, int index = -1 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts a new list box pixmap item with the pixmap \fIpixmap\fR into the list at position \fIindex\fR..PPIf \fIindex\fR is negative, \fIpixmap\fR is inserted at the end of the list..PPSee also insertStrList()..SH "void QListBox::insertItem ( const QPixmap & pixmap, const QString & text, int index = -1 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts a new list box pixmap item with the pixmap \fIpixmap\fR and the text \fItext\fR into the list at position \fIindex\fR..PPIf \fIindex\fR is negative, \fIpixmap\fR is inserted at the end of the list..PPSee also insertStrList()..SH "void QListBox::insertStrList ( const QStrList * list, int index = -1 )"Inserts the string list \fIlist\fR into the list at position \fIindex\fR..PPIf \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored..PP\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings..PP\fBWarning:\fR This function is never significantly faster than a loop around insertItem()..PPSee also insertItem() and insertStringList()..SH "void QListBox::insertStrList ( const QStrList & list, int index = -1 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts the string list \fIlist\fR into the list at position \fIindex\fR..PPIf \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored..PP\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings..PP\fBWarning:\fR This function is never significantly faster than a loop around insertItem()..PPSee also insertItem() and insertStringList()..SH "void QListBox::insertStrList ( const char ** strings, int numStrings = -1, int index = -1 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPInserts the \fInumStrings\fR strings of the array \fIstrings\fR into the list at position \fIindex\fR..PPIf \fIindex\fR is negative, insertStrList() inserts \fIstrings\fR at the end of the list. If \fIindex\fR is too large, the operation is ignored..PP\fBWarning:\fR This function uses \fCconst char *\fR rather than QString, so we recommend against using it. It is provided so that legacy code will continue to work, and so that programs that certainly will not need to handle code outside a single 8-bit locale can use it. See insertStringList() which uses real QStrings..PP\fBWarning:\fR This function is never significantly faster than a loop around insertItem()..PPSee also insertItem() and insertStringList()..SH "void QListBox::insertStringList ( const QStringList & list, int index = -1 )"Inserts the string list \fIlist\fR into the list at position \fIindex\fR..PPIf \fIindex\fR is negative, \fIlist\fR is inserted at the end of the list. If \fIindex\fR is too large, the operation is ignored..PP\fBWarning:\fR This function is never significantly faster than a loop around insertItem()..PPSee also insertItem() and insertStrList()..SH "void QListBox::invertSelection ()\fC [virtual slot]\fR"Inverts the selection. Only works in Multi and Extended selection mode..SH "bool QListBox::isMultiSelection () const"Returns TRUE if or not the list box is in Multi selection mode; otherwise returns FALSE. See the "multiSelection" property for details..SH "bool QListBox::isRubberSelecting () const\fC [protected]\fR"Returns TRUE if the user is selecting items using a rubber band rectangle; otherwise returns FALSE..SH "bool QListBox::isSelected ( int i ) const"Returns TRUE if item \fIi\fR is selected; otherwise returns FALSE..SH "bool QListBox::isSelected ( const QListBoxItem * i ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns TRUE if item \fIi\fR is selected; otherwise returns FALSE..SH "QListBoxItem * QListBox::item ( int index ) const"Returns a pointer to the item at position \fIindex\fR, or 0 if \fIindex\fR is out of bounds..PPSee also index()..PPExample: listboxcombo/listboxcombo.cpp..SH "QListBoxItem * QListBox::itemAt ( const QPoint & p ) const"Returns the item at point \fIp\fR, which is in on-screen coordinates, or a 0 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\fR. \fIindex\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 that \fIitem\fR occupies in viewport()'s coordinates, or an invalid rectangle if \fIitem\fR is 0 or is not currently visible..SH "bool QListBox::itemVisible ( int index )"Returns TRUE if the item at position \fIindex\fR is at least partly visible; otherwise returns FALSE..SH "bool QListBox::itemVisible ( const QListBoxItem * item )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns TRUE if \fIitem\fR is at least partly visible; otherwise returns FALSE..SH "bool QListBox::itemYPos ( int index, int * yPos ) const\fC [protected]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPReturns the vertical pixel-coordinate in \fI*yPos\fR, of the list box item at position \fIindex\fR in the list. Returns FALSE if the item is outside the visible area..SH "long QListBox::maxItemWidth () const"Returns the width of the widest item in the list box..SH "void QListBox::mouseButtonClicked ( int button, QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"This signal is emitted when the user clicks mouse button \fIbutton\fR. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item..PP\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos()). (If the click's press and release differs by a pixel or two, \fIpos\fR is the position at release time.).PPNote that you must not delete any QListBoxItem objects in slots connected to this signal..SH "void QListBox::mouseButtonPressed ( int button, QListBoxItem * item, const QPoint & pos )\fC [signal]\fR"This signal is emitted when the user presses mouse button \fIbutton\fR. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item..PP\fIpos\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos())..PPNote that you must not delete any QListBoxItem objects in slots connected to this signal..SH "int QListBox::numCols () const"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPReturns the number of columns..PPSee also numColumns..SH "int QListBox::numColumns () const"Returns the number of columns in the list box. See the "numColumns" property for details..SH "int QListBox::numItemsVisible () const"Returns the number of visible items. See the "numItemsVisible" property for details..SH "int QListBox::numRows () const"Returns the number of rows in the list box. See the "numRows" property for details..SH "void QListBox::onItem ( QListBoxItem * i )\fC [signal]\fR"This signal is emitted when the user moves the mouse cursor onto an item, similar to the QWidget::enterEvent() function. \fIi\fR is the QListBoxItem that the mouse has moved on..SH "void QListBox::onViewport ()\fC [signal]\fR"This signal is emitted when the user moves the mouse cursor from an item to an empty part of the list box..SH "void QListBox::paintCell ( QPainter * p, int row, int col )\fC [virtual protected]\fR"Provided for compatibility with the old QListBox. We recommend using QListBoxItem::paint() instead..PPRepaints the cell at \fIrow\fR, \fIcol\fR using painter \fIp\fR..SH "const QPixmap * QListBox::pixmap ( int index ) const"Returns a pointer to the pixmap at position \fIindex\fR, or 0 if there is no pixmap there..PPSee also text()..SH "void QListBox::pressed ( QListBoxItem * item )\fC [signal]\fR"This signal is emitted when the user presses any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item..PPNote that you must not delete any QListBoxItem objects in slots connected to this signal..SH "void QListBox::pressed ( QListBoxItem * item, const QPoint & pnt )\fC [signal]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThis signal is emitted when the user presses any mouse button. If \fIitem\fR is not 0, the cursor is on \fIitem\fR. If \fIitem\fR is 0, the mouse cursor isn't on any item..PP\fIpnt\fR is the position of the mouse cursor in the global coordinate system (QMouseEvent::globalPos())..PPNote that you must not delete any QListBoxItem objects in slots connected to this signal..PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -