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

📄 qlistview.3qt

📁 Trolltech公司发布的基于C++图形开发环境
💻 3QT
📖 第 1 页 / 共 3 页
字号:
.br  if ( i ) {.br      if ( p.x() > header()->cellPos( header()->mapToActual( 0 ) ) +.br             treeStepSize() * ( i->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() ||.br             p.x() < header()->cellPos( header()->mapToActual( 0 ) ) ) {.br          ; // p is not not in root decoration.br      else.br          ; // p is in the root decoration.br  }.fi.PPThis might be interesting if you use this method to find out where the user clicked and if you e.g. want to start a drag (which you do not want to do if the user clicked onto the root decoration of an item).PPSee also itemPos() and itemRect()..SH "int QListView::itemMargin () const"Returns the advisory item margin which list items may use..PPSee also QListViewItem::paintCell() and setItemMargin()..SH "int QListView::itemPos ( const QListViewItem * item )"Returns the y coordinate of \fIitem\fR in the list view's coordinate system. This functions is normally much slower than itemAt(), but it works for all items, while itemAt() normally works only for items on the screen..PPThis is a thin wrapper around QListViewItem::itemPos()..PPSee also itemAt() and itemRect()..SH "QRect QListView::itemRect ( const QListViewItem * i ) const"Returns the rectangle on the screen \fIi\fR occupies in viewport()'s coordinates, or an invalid rectangle if \fIi\fR is a null pointer or is not currently visible..PPThe rectangle returned does not include any children of the rectangle (ie. it uses QListViewItem::height() rather than QListViewItem::totalHeight()). If you want the rectangle including children, you can use something like this code:.PP.nf.br    QRect r( listView->itemRect( item ) );.br    r.setHeight( (QCOORD)(QMIN( item->totalHeight(),.br                                listView->viewport->height() - r.y() ) ) ).fi.PPNote the way it avoids too-high rectangles. totalHeight() can be much larger than the window system's coordinate system allows..PPitemRect() is comparatively slow. It's best to call it only for items that are probably on-screen..SH "void QListView::keyPressEvent ( QKeyEvent * e ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "QSize QListView::minimumSizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QListView::mouseButtonClicked ( int button, QListViewItem * item, const QPoint & pos, int c ) \fC[signal]\fR"This signal is emitted whenever the user clicks (mouse pressed + mouse released) into the listview. \fIbutton\fR is the mouse button which the user pressed, \fIitem\fR is the pointer to the clicked listview item or NULL, if the user didn't click on an item, and \fIc\fR the listview column into which the user pressed (this argument is only valid, if \fIitem\fR is not NULL!).PPNote that you may not delete any QListViewItem objects in slots connected to this signal..SH "void QListView::mouseButtonPressed ( int button, QListViewItem * item, const QPoint & pos, int c ) \fC[signal]\fR"This signal is emitted whenever the user pressed the mouse button onto the listview. \fIbutton\fR is the mouse button which the user pressed, \fIitem\fR is the pointer to the pressed listview item or NULL, if the user didn't press on an item, and \fIc\fR the listview column into which the user pressed (this argument is only valid, if \fIitem\fR is not NULL!).PPNote that you may not delete any QListViewItem objects in slots connected to this signal..SH "void QListView::onItem ( QListViewItem * 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 QListView::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 QListView::paintEmptyArea ( QPainter * p, const QRect & rect ) \fC[virtual protected]\fR"Paints \fIrect\fR so that it looks like empty background using painter p. \fIrect\fR is is widget coordinates, ready to be fed to \fIp.\fR.PPThe default function fills \fIrect\fR with colorGroup().brush( QColorGroup::Base )..SH "void QListView::pressed ( QListViewItem * item ) \fC[signal]\fR"This signal is emitted whenever the user presses the mouse button on a listview. \fIitem\fR is the pointer to the listview 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 QListViewItem objects in slots connected to this signal..SH "void QListView::pressed ( QListViewItem * item, const QPoint & pnt, int c ) \fC[signal]\fR"This signal is emitted whenever the user presses the mouse button on a listview. \fIitem\fR is the pointer to the listview 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, and \fIc\fR the column into which the mouse cursor was when the user pressed the mouse button..PPNote that you may not delete any QListViewItem objects in slots connected to this signal..SH "void QListView::removeColumn ( int index )"Removes the column at position \fIindex.\fR.SH "void QListView::removeItem ( QListViewItem * i ) \fC[virtual]\fR"\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..PPThis function has been renamed takeItem()..SH "void QListView::repaintItem ( const QListViewItem * item ) const"Repaints \fIitem\fR on the screen, if \fIitem\fR is currently visible. Takes care to avoid multiple repaints..SH "void QListView::resizeEvent ( QResizeEvent * e ) \fC[virtual protected]\fR"Ensures that the header is correctly sized and positioned..PPReimplemented from QWidget..SH "void QListView::returnPressed ( QListViewItem * ) \fC[signal]\fR"This signal is emitted when enter or return is pressed. The argument is currentItem()..SH "void QListView::rightButtonClicked ( QListViewItem *, const QPoint &, int ) \fC[signal]\fR"This signal is emitted when the right button is clicked (ie. when it's released). The arguments are the relevant QListViewItem (may be 0), the point in global coordinates and the relevant column (or -1 if the click was outside the list)..SH "void QListView::rightButtonPressed ( QListViewItem *, const QPoint &, int ) \fC[signal]\fR"This signal is emitted when the right button is pressed. Then arguments are the relevant QListViewItem (may be 0), the point in global coordinates and the relevant column (or -1 if the click was outside the list)..SH "bool QListView::rootIsDecorated () const"Returns TRUE if root items can be opened and closed by the user, FALSE if not..SH "void QListView::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 "QListViewItem * QListView::selectedItem () const"Returns a pointer to the selected item, if the list view is in single-selection mode and an item is selected..PPIf no items are selected or the list view is in multi-selection mode this function returns 0..PPSee also setSelected() and setMultiSelection()..SH "void QListView::selectionChanged () \fC[signal]\fR"This signal is emitted whenever the set of selected items has changed (normally before the screen update). It is available both in single-selection and multi-selection mode, but is most meaningful in multi-selection mode..PPNote that you may not delete any QListViewItem objects in slots connected to this signal..PPSee also setSelected() and QListViewItem::setSelected()..SH "void QListView::selectionChanged ( QListViewItem * ) \fC[signal]\fR"This signal is emitted whenever the selected item has changed in single-selection mode (normally after the screen update). The argument is the newly selected item..PPThere is another signal which is more useful in multi-selection mode..PPNote that you may not delete any QListViewItem objects in slots connected to this signal..PPSee also setSelected(), QListViewItem::setSelected() and currentChanged()..SH "QListView::SelectionMode QListView::selectionMode() const"Returns the selection mode of the list view. The initial mode is \fCSingle.\fR.PPSee also setSelectionMode(), isMultiSelection() and setMultiSelection()..SH "void QListView::setAllColumnsShowFocus ( bool enable ) \fC[virtual]\fR"Sets this list view to assume that the items show focus and selection state using all of their columns if \fIenable\fR is TRUE, or that they show it just using column 0 if \fIenable\fR is FALSE..PPThe default is FALSE..PPSetting this to TRUE if it isn't necessary can cause noticeable flicker..PPSee also allColumnsShowFocus()..PPExamples:.(ldirview/main.cpp.)l.SH "void QListView::setColumnAlignment ( int column, int align ) \fC[virtual]\fR"Configures the logical column \fIcolumn\fR to have alignment \fIalign.\fR The alignment is ultimately passed to QListViewItem::paintCell() for each item in the view..PPSee also Qt::AlignmentFlags..SH "void QListView::setColumnText ( int column, const QIconSet & iconset, const QString & label ) \fC[virtual]\fR"Sets the heading text of column \fIcolumn\fR to \fIiconset\fR and \fIlabel.\fR The leftmost colum is number 0..SH "void QListView::setColumnText ( int column, const QString & label ) \fC[virtual]\fR"Sets the heading text of column \fIcolumn\fR to \fIlabel.\fR The leftmost colum is number 0..SH "void QListView::setColumnWidth ( int column, int w ) \fC[virtual]\fR"Sets the width of column \fIcolumn\fR to \fIw\fR pixels. Note that if the column has a WidthMode other than Manual, this width setting may be subsequently overridden. The leftmost colum is number 0..SH "void QListView::setColumnWidthMode ( int c, WidthMode mode )"Sets column \fIc\fR to behave according to \fImode.\fR The default depends on whether the width argument to addColumn was positive or negative..PPSee also QListViewItem::width()..SH "void QListView::setContentsPos ( int x, int y ) \fC[virtual slot]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QScrollView..SH "void QListView::setCurrentItem ( QListViewItem * i ) \fC[virtual]\fR"Sets \fIi\fR to be the current highlighted item and repaints appropriately. This highlighted item is used for keyboard navigation and focus indication; it doesn't mean anything else..PPSee also currentItem()..SH "void QListView::setFont ( const QFont & f ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..SH "void QListView::setItemMargin ( int m ) \fC[virtual]\fR"Sets the advisory item margin which list items may use to \fIm.\fR.PPThe item margin defaults to one pixel and is the margin between the item's edges and the area where it draws its contents. QListViewItem::paintFocus() draws in the margin..PPSee also QListViewItem::paintCell()..SH "void QListView::setMultiSelection ( bool enable ) \fC[virtual]\fR"Sets the list view to multi-selection mode if \fIenable\fR is TRUE, and to single-selection mode if \fIenable\fR is FALSE..PPIf you enable multi-selection mode, it's possible to specify if this mode should be extended or not. Extended means, that the user can only select multiple items when pressing the Shift or Control button at the same time..PPSee also isMultiSelection()..SH "void QListView::setOpen ( QListViewItem * item, bool open ) \fC[virtual]\fR"Sets \fIitem\fR to be open if \fIopen\fR is TRUE and \fIitem\fR is expandable, and to be closed if \fIopen\fR is FALSE. Repaints accordingly..PPDoes nothing if \fIitem\fR is not expandable..PPSee also QListViewItem::setOpen() and QListViewItem::setExpandable()..SH "void QListView::setPalette ( const QPalette & p ) \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..SH "void QListView::setRootIsDecorated ( bool enable ) \fC[virtual]\fR"Sets this list view to show open/close signs on root items if \fIenable\fR is TRUE, and to not show such signs if \fIenable\fR is FALSE..PPOpen/close signs is a little + or - in windows style, an arrow in Motif style..SH "void QListView::setSelected ( QListViewItem * item, bool selected ) \fC[virtual]\fR"Sets \fIitem\fR to be selected if \fIselected\fR is TRUE, and to be not selected if \fIselected\fR is FALSE..PPIf the list view is in single-selection mode and \fIselected\fR is TRUE, the currently selected item is unselected and \fIitem\fR made current. Unlike QListViewItem::setSelected(), this function updates the list view as necessary and emits the selectionChanged() signals..PPSee also isSelected(), setMultiSelection(), isMultiSelection() and setCurrentItem()..SH "void QListView::setSelectionMode ( SelectionMode mode )"Sets the list view's selection mode, which may be one of \fCSingle\fR (the default), \fCExtended, Multi\fR or \fCNoSelection.\fR.PPSee also selectionMode()..SH "void QListView::setShowSortIndicator ( bool show )"If \fIshow\fR is TRUE, draw an arrow in the header of the listview to indicate the sort order of the listview contents. The arrow will be drawn in the correct column and will point to the correct direction. Set \fIshow\fR to FALSE to disable this feature..PPSee also QHeader::setSortIndicator()..SH "void QListView::setSorting ( int column, bool ascending = TRUE ) \fC[virtual]\fR"Set the list view to be sorted by \fIcolumn\fR and to be sorted in ascending order if \fIascending\fR is TRUE or descending order if it is FALSE..PPIf \fIcolumn\fR is -1, sorting is disabled and the user cannot sort columns by clicking on the column headers..SH "void QListView::setTreeStepSize ( int l ) \fC[virtual]\fR"Sets the the number of pixels a child is offset from its parent, in a tree view to \fIl.\fR The default is 20..PPSee also treeStepSize()..PPExamples:.(ldirview/main.cpp.)l.SH "void QListView::show () \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPExamples:.(ldirview/main.cpp.)l.PPReimplemented from QWidget..SH "void QListView::showEvent ( QShowEvent * ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "bool QListView::showSortIndicator () const"Returns TRUE, if the sort order and column are indicated in the header, else FALSE..PPSee also QListView::setSortIndicator()..SH "QSize QListView::sizeHint () const \fC[virtual]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QListView::sort ()"(Re)sorts the listview using the last sorting configuration (sort column and ascending/descending)..SH "void QListView::styleChange ( QStyle & old ) \fC[virtual protected]\fR"Reimplemented for internal reasons; the API is not affected..PPReimplemented from QWidget..SH "void QListView::takeItem ( QListViewItem * i ) \fC[virtual]\fR"Removes \fIi\fR from the list view; \fIi\fR must be a top-level item. The warnings regarding QListViewItem::takeItem( i ) apply to this function too..PPSee also QListViewItem::takeItem(), (important) and insertItem()..SH "int QListView::treeStepSize () const"Returns the number of pixels a child is offset from its parent. This number has meaning only for tree views. The default is 20..PPSee also setTreeStepSize()..SH "void QListView::triggerUpdate () \fC[slot]\fR"Triggers a size, geometry and content update during the next iteration of the event loop. Cleverly makes sure that there'll be just one update, to avoid flicker..SH "void QListView::updateContents () \fC[protected slot]\fR"Updates the sizes of the viewport, header, scrollbars and so on.Don't call this directly; call triggerUpdate() instead..SH "SEE ALSO".BR http://doc.trolltech.com/qlistview.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qlistview.3qt) and the Qtversion (2.3.10).

⌨️ 快捷键说明

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