⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qlistbox.3qt

📁 tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件
💻 3QT
📖 第 1 页 / 共 3 页
字号:
.BI "virtual void \fBviewportMousePressEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBviewportMouseReleaseEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBviewportMouseDoubleClickEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBviewportMouseMoveEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBmousePressEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBmouseReleaseEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBmouseDoubleClickEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBmouseMoveEvent\fR ( QMouseEvent * )".br.ti -1c.BI "virtual void \fBkeyPressEvent\fR ( QKeyEvent * e )".br.ti -1c.BI "virtual void \fBfocusInEvent\fR ( QFocusEvent * e )".br.ti -1c.BI "virtual void \fBfocusOutEvent\fR ( QFocusEvent * e )".br.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * )".br.ti -1c.BI "virtual void \fBshowEvent\fR ( QShowEvent * )".br.ti -1c.BI "void \fBupdateItem\fR ( int index )".br.ti -1c.BI "void \fBupdateItem\fR ( QListBoxItem * )".br.ti -1c.BI "virtual void \fBpaintCell\fR ( QPainter *, int " "row" ", int col )".br.ti -1c.BI "void \fBtoggleCurrentItem\fR ()".br.ti -1c.BI "void \fBupdateVector\fR ()".br.ti -1c.BI "void \fBdoLayout\fR () const".br.in -1c.SH DESCRIPTIONThe QListBox widget provides a list of selectable, read-only items..PPThis is typically a single-column list where zero or one item items are selected at once, but can also be used in many other ways..PPQListBox will add scroll bars as necessary, but isn't intended for \fIreally\fR big lists. If you want more than a few thousand items, it's probably better to use a different widget, chiefly because the scroll bars won't provide very good navigation, but also because QListBox may become slow at larger sizes..PPThere is a variety of selection modes. The default is single-selection, but you can change it using setSelectionMode()..PPThe list box normally arranges its items in a single column with a vertical scroll bar if necessary, but it is also possible to have a different fixed number of columns (setColumnMode()), or as many columns as will fit in the list box' assigned screen space (setColumnMode( FitToWidth )), or to have a fixed number of rows (setRowMode()), or as many rows as will fit in the list box' assigned screen space (setRowMode( FitToHeight )). In all these cases, QListBox will add scroll bars as appropriate in at least one direction..PPIf multiple rows is used, each row can be as high as necessary (the normal setting), or you can request that all items will have the same height by calling setVariableHeight( FALSE ). Of course there is a similar setVariableWidth()..PPThe items discussed are QListBoxItem objects. QListBox provides methods to insert new items as a string, as pixmaps, and as QListBoxItem * (insertItem() with various arguments), and to replace an existing item with a new string, pixmap or QListBoxItem (changeItem() with various arguments). You can also remove items (surprise: removeItem()) and clear() the entire list box. Note that if you create a QListBoxItem yourself and insert it, it becomes the property of QListBox and you may not delete it. (QListBox will delete it when appropriate.).PPYou can also create a QListBoxItem such as QListBoxText or QListBoxPixmap with the list box as first parameter. The item will then append itself. When deleteting an item, it will automatically be remove from the listbox again..PPThe list of items can be arbitrarily big; if necessary, QListBox adds scroll bars. It can be single-column (as most list boxes are) or multi-column, and offers both single and multiple selection. (QListBox does however not support multiple-column items; QListView does that job.).PPThe list box items can be accessed both as QListBoxItem objects (recommended) and using integer indexes (the original QListBox implementation used an array of strings internally, and the API still supports this mode of operation). Everything can be done using the new objects; most things can be done using the indexes too but unfortunately not everything..PPEach item in a QListBox contains a QListBoxItem. One of the items can be the current item. The highlighted() signal is emitted when the user highlights a new current item; selected() is emitted when the user double-clicks on an item or presses return when an item is highlighted..PPIf the user does not select anything, no signals are emitted and currentItem() returns -1..PPA list box has \fCWheelFocus\fR as a default focusPolicy(), i.e. it can get keyboard focus both by tabbing, clicking and the mouse wheel..PPNew items may be inserted using either insertItem(), insertStrList() and inSort()..PPBy default, vertical and horizontal scroll bars are added and removed as necessary. setAutoScrollBar() can be used to force a specific policy..PPIf you need to insert other types than texts and pixmaps, you must define new classes which inherit QListBoxItem..PP\fBWarning:\fR The list box assumes ownership of all list box items and will delete them when is does not need them any more..PP<img src=qlistbox-m.png> <img src=qlistbox-w.png>.PPSee also: QListView, QComboBox, QButtonGroup and GUI Design Handbook: List Box (two sections).PPExamples:.(ltabdialog/tabdialog.cpp.)l.SS "Member Type Documentation".SH "QListBox::SelectionMode"This enumerated type is used by QListBox to indicate how it reacts to selection by the user. It has three values: .IP.TP\fCSingle\fR - When the user selects an item, any already-selected item becomes unselected, and the user cannot unselect the selected item. This means that the user can never clear the selection, even though the selection may be cleared by the application programmer using <a href="qlistbox.html#0df7dc">QListBox::clear()..IP.TP\fCExtended\fR - When the user selects an item in the most ordinary way, the selection is cleared and the new item selected. However, if the user then selects more items \fIin the same operation\fR (by dragging the mouse), these other items are also selected. There may also be other ways to select multiple items..IP.TP\fCMulti\fR - When the user selects an item in the most ordinary way, the selection status of that item is toggled and the other items are left alone..IP.PPIn other words, \fCSingle\fR is a real single-selection list box, \fCMulti\fR a real multi-selection list box, and \fCExtended\fR list box where users can select multiple items but usually want to select either just one or a range of contiguous items..SH MEMBER FUNCTION DOCUMENTATION.SH "QListBox::QListBox ( QWidget * parent=0, const char * name=0, WFlags f=0 )"Constructs a list box. The arguments are passed directly to the QScrollView constructor..SH "QListBox::~QListBox ()"Destroys the list box. Deletes all list box items..SH "void QListBox::changeItem ( const QListBoxItem * lbi, int index )"Replaces the item at position \fIindex\fR with \fIlbi.\fR If \fIindex\fR is negative or too large, changeItem() does nothing..PPSee also: insertItem() and removeItem()..SH "void QListBox::changeItem ( const QPixmap & pixmap, int index )"Replaces the item at position \fIindex\fR with \fIpixmap.\fR.PPThe operation is ignored if \fIindex\fR is out of range..PPSee also: insertItem() and removeItem()..SH "void QListBox::changeItem ( const QString & text, int index )"Replaces the item at position \fIindex\fR with \fItext.\fR.PPThe operation is ignored if \fIindex\fR is out of range..PPSee also: insertItem() and removeItem()..SH "void QListBox::clear ()"Deletes all items in the list..PPSee also: removeItem() and setStrList()..SH "void QListBox::clearSelection () \fC[virtual slot]\fR"Deselects all items, if possible..PPNote that a single-selection listbox will automatically select an item if it has keyboard focus..SH "uint QListBox::count () const"Returns the number of items in the list box..SH "int QListBox::currentItem () const"Returns the index of the current (highlighted) item of the list box, or -1 if no item has been selected..PPSee also: topItem()..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::ensureCurrentVisible () \fC[virtual slot]\fR"Ensures that the current item is visible..SH "void QListBox::focusInEvent ( QFocusEvent * ) \fC[virtual protected]\fR"Handles focus events. Repaints the current item (if not set, topItem() is made current)..PPSee also: keyPressEvent() and focusOutEvent()..PPReimplemented from QWidget..SH "void QListBox::focusOutEvent ( QFocusEvent * ) \fC[virtual protected]\fR"Handles focus out events. Repaints the current item, if set..PPSee also: keyPressEvent() and focusOutEvent()..PPReimplemented from QWidget..SH "void QListBox::highlighted ( const QString & ) \fC[signal]\fR"This 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 ( int index ) \fC[signal]\fR"This signal is emitted when the user highlights a new current item. The argument is the index of the new item, which is already current..PPSee also: selected(), currentItem() and selectionChanged()..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..PPSee also: item()..SH "void QListBox::insertItem ( const QListBoxItem * lbi, int index=-1 )"Inserts the item \fIlbi\fR into the list at \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()..SH "void QListBox::insertItem ( const QPixmap & pixmap, int index=-1 )"Inserts \fIpixmap\fR into the list at \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 QString & text, int index=-1 )"Inserts \fItext\fR into the list at \fIindex.\fR.PPIf \fIindex\fR is negative, \fItext\fR is inserted at the end of the list..PPSee also: insertStrList()..PPExamples:.(ltabdialog/tabdialog.cpp.)l.SH "void QListBox::insertStrList ( const QStrList & list, int index=-1 )"Inserts the string list \fIlist\fR into the list at item \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() - it uses real QStrings..PP\fBWarning:\fR This function is never significantly faster than a loop around insertItem()..PPSee also: insertItem() and inSort()..SH "void QListBox::insertStrList ( const QStrList * list, int index=-1 )"Inserts the string list \fIlist\fR into the list at item \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() - it uses real QStrings..PP\fBWarning:\fR This function is never significantly faster than a loop around insertItem()..PPSee also: insertItem() and inSort()..SH "void QListBox::insertStrList ( const char ** strings, int numStrings=-1, int index=-1 )"Inserts the \fInumStrings\fR strings of the array \fIstrings\fR into the list at item\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() - it uses real QStrings..PP\fBWarning:\fR This function is never significantly faster than a loop around insertItem()..PPSee also: insertItem() and inSort()..SH "void QListBox::insertStringList ( const QStringList & list, int index=-1 )"Inserts the string list \fIlist\fR into the list at item \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 inSort()..SH "bool QListBox::isMultiSelection () const"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -