📄 qlistview.3qt
字号:
.TH QListView 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQListView \- Implements a list/tree view.SH SYNOPSIS.br.PP\fC#include <qlistview.h>\fR.PPInherits QScrollView..PPInherited by QFileListView..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQListView\fR ( QWidget * " "parent" " = 0, const char * " "name" " = 0 )".br.ti -1c.BI "\fB~QListView\fR ()".br.ti -1c.BI "int \fBtreeStepSize\fR () const".br.ti -1c.BI "virtual void \fBsetTreeStepSize\fR ( int )".br.ti -1c.BI "virtual void \fBinsertItem\fR ( QListViewItem * )".br.ti -1c.BI "virtual void \fBtakeItem\fR ( QListViewItem * )".br.ti -1c.BI "virtual void \fBremoveItem\fR ( QListViewItem * )".br.ti -1c.BI "virtual void \fBclear\fR ()".br.ti -1c.BI "QHeader* \fBheader\fR () const".br.ti -1c.BI "virtual int \fBaddColumn\fR ( const QString & " "label" ", int " "size" " = -1 )".br.ti -1c.BI "virtual int \fBaddColumn\fR ( const QIconSet & " "iconset" ", const QString & " "label" ", int " "size" " = -1 )".br.ti -1c.BI "virtual void \fBsetColumnText\fR ( int " "column" ", const QString & label )".br.ti -1c.BI "virtual void \fBsetColumnText\fR ( int " "column" ", const QIconSet & " "iconset" ", const QString & label )".br.ti -1c.BI "QString \fBcolumnText\fR ( int column ) const".br.ti -1c.BI "virtual void \fBsetColumnWidth\fR ( int " "column" ", int width )".br.ti -1c.BI "int \fBcolumnWidth\fR ( int column ) const".br.ti -1c.BI "enum \fBWidthMode\fR { Manual, Maximum }".br.ti -1c.BI "virtual void \fBsetColumnWidthMode\fR ( int " "column" ", WidthMode )".br.ti -1c.BI "WidthMode \fBcolumnWidthMode\fR ( int column ) const".br.ti -1c.BI "virtual void \fBsetColumnAlignment\fR ( int, int )".br.ti -1c.BI "int \fBcolumnAlignment\fR ( int ) const".br.ti -1c.BI "virtual void \fBshow\fR ()".br.ti -1c.BI "QListViewItem* \fBitemAt\fR ( const QPoint & screenPos ) const".br.ti -1c.BI "QRect \fBitemRect\fR ( const QListViewItem * ) const".br.ti -1c.BI "int \fBitemPos\fR ( const QListViewItem * )".br.ti -1c.BI "void \fBensureItemVisible\fR ( const QListViewItem * )".br.ti -1c.BI "void \fBrepaintItem\fR ( const QListViewItem * ) const".br.ti -1c.BI "virtual void \fBsetMultiSelection\fR ( bool enable )".br.ti -1c.BI "bool \fBisMultiSelection\fR () const".br.ti -1c.BI "virtual void \fBclearSelection\fR ()".br.ti -1c.BI "virtual void \fBsetSelected\fR ( QListViewItem *, bool )".br.ti -1c.BI "bool \fBisSelected\fR ( const QListViewItem * ) const".br.ti -1c.BI "QListViewItem* \fBselectedItem\fR () const".br.ti -1c.BI "virtual void \fBsetOpen\fR ( QListViewItem *, bool )".br.ti -1c.BI "bool \fBisOpen\fR ( const QListViewItem * ) const".br.ti -1c.BI "virtual void \fBsetCurrentItem\fR ( QListViewItem * )".br.ti -1c.BI "QListViewItem* \fBcurrentItem\fR () const".br.ti -1c.BI "QListViewItem* \fBfirstChild\fR () const".br.ti -1c.BI "int \fBchildCount\fR () const".br.ti -1c.BI "virtual void \fBsetAllColumnsShowFocus\fR ( bool )".br.ti -1c.BI "bool \fBallColumnsShowFocus\fR () const".br.ti -1c.BI "virtual void \fBsetItemMargin\fR ( int )".br.ti -1c.BI "int \fBitemMargin\fR () const".br.ti -1c.BI "virtual void \fBsetRootIsDecorated\fR ( bool )".br.ti -1c.BI "bool \fBrootIsDecorated\fR () const".br.ti -1c.BI "virtual void \fBsetSorting\fR ( int " "column" ", bool " "increasing" " = TRUE )".br.ti -1c.BI "virtual void \fBsetFont\fR ( const QFont & )".br.ti -1c.BI "virtual void \fBsetPalette\fR ( const QPalette & )".br.ti -1c.BI "virtual bool \fBeventFilter\fR ( QObject * " "o" ", QEvent * )".br.ti -1c.BI "virtual QSize \fBsizeHint\fR () const".br.ti -1c.BI "virtual QSize \fBminimumSizeHint\fR () const".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "void \fBtriggerUpdate\fR ()".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBselectionChanged\fR ()".br.ti -1c.BI "void \fBselectionChanged\fR ( QListViewItem * )".br.ti -1c.BI "void \fBcurrentChanged\fR ( QListViewItem * )".br.ti -1c.BI "void \fBdoubleClicked\fR ( QListViewItem * )".br.ti -1c.BI "void \fBreturnPressed\fR ( QListViewItem * )".br.ti -1c.BI "void \fBrightButtonClicked\fR ( QListViewItem *, const QPoint &, int )".br.ti -1c.BI "void \fBrightButtonPressed\fR ( QListViewItem *, const QPoint &, int )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBcontentsMousePressEvent\fR ( QMouseEvent * e )".br.ti -1c.BI "virtual void \fBcontentsMouseReleaseEvent\fR ( QMouseEvent * e )".br.ti -1c.BI "virtual void \fBcontentsMouseMoveEvent\fR ( QMouseEvent * e )".br.ti -1c.BI "virtual void \fBcontentsMouseDoubleClickEvent\fR ( QMouseEvent * 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 \fBkeyPressEvent\fR ( QKeyEvent * e )".br.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * e )".br.ti -1c.BI "virtual void \fBshowEvent\fR ( QShowEvent * )".br.ti -1c.BI "virtual void \fBdrawContentsOffset\fR ( QPainter *, int " "ox" ", int " "oy" ", int " "cx" ", int " "cy" ", int " "cw" ", int ch )".br.ti -1c.BI "virtual void \fBpaintEmptyArea\fR ( QPainter *, const QRect & )".br.ti -1c.BI "virtual void \fBenabledChange\fR ( bool )".br.ti -1c.BI "virtual void \fBstyleChange\fR ( QStyle & )".br.in -1c.SS "Protected Slots".in +1c.ti -1c.BI "void \fBupdateContents\fR ()".br.ti -1c.BI "void \fBdoAutoScroll\fR ()".br.in -1c.SH DESCRIPTIONThe QListView class implements a list/tree view..PPIt can display and control a hierarchy of multi-column items, and provides the ability to add new items at run-time, let the user select one or many items, sort the list in increasing or decreasing order by any column, and so on..PPThe simplest mode of usage is to create a QListView, add some column headers using setColumn(), create one or more QListViewItem objects with the QListView as parent, set up the list view's geometry(), and show() it..PPThe main setup functions are .IP.TPaddColumn() - adds a column, with text and perhaps width..IP.TPsetColumnWidthMode() - sets the column to be resized automatically or not..IP.TPsetMultiSelection() - decides whether one can select one or many objects in this list view. The default is FALSE (selecting one item unselects any other selected item)..IP.TPsetAllColumnsShowFocus() - decides whether items should show keyboard focus using all columns, or just column 0. The default is to show focus using just column 0..IP.TPsetRootIsDecorated() - decides whether root items can be opened and closed by the user, and have open/close decoration to their left. The default is FALSE..IP.TPsetTreeStepSize() - decides the how many pixels an item's children are indented relative to their parent. The default is 20. This is mostly a matter of taste..IP.TPsetSorting() - decides whether the items should be sorted, whether it should be in ascending or descending order, and by what column it should be sorted..PPTo handle events such as mouse-presses on the listview, derived classes can override the QScrollView functions contentsMousePressEvent, contentsMouseReleaseEvent, contentsMouseDoubleClickEvent, contentsMouseMoveEvent, contentsDragEnterEvent, contentsDragMoveEvent, contentsDragLeaveEvent, contentsDropEvent, and contentsWheelEvent..PPThere are also several functions for mapping between items and coordinates. itemAt() returns the item at a position on-screen, itemRect() returns the rectangle an item occupies on the screen and itemPos() returns the position of any item (not on-screen, in the list view). firstChild() returns the item at the top of the view (not necessarily on-screen) so you can iterate over the items using either QListViewItem::itemBelow() or a combination of QListViewItem::firstChild() and QListViewItem::nextSibling()..PPNaturally, QListView provides a clear() function, as well as an explicit insertItem() for when QListViewItem's default insertion won't do..PPSince QListView offers multiple selection it has to display keyboard focus and selection state separately. Therefore there are functions both to set the selection state of an item, setSelected(), and to select which item displays keyboard focus, setCurrentItem()..PPQListView emits two groups of signals: One group signals changes in selection/focus state and one signals selection. The first group consists of selectionChanged(), applicable to all list views, and selectionChanged( QListViewItem * ), applicable only to single-selection list view, and currentChanged( QListViewItem * ). The second group consists of doubleClicked( QListViewItem * ), returnPressed( QListViewItem * ) and rightButtonClicked( QListViewItem *, const QPoint&, int )..PPIn Motif style, QListView deviates fairly strongly from the look and feel of the Motif hierarchical tree view. This is done mostly to provide a usable keyboard interface and to make the list view look better with a white background..PP<img src="listview.png" width="518" height="82" alt="Example List View">.brWindows style, flat (from QFileDialog).PP<img src="treeview.png" width="256" height="216" alt="Example Tree View">.brMotif style, hierarchical (from the dirview/dirview.cpp example)..SH MEMBER FUNCTION DOCUMENTATION.SH "QListView::QListView ( QWidget * parent = 0, const char * name = 0 )"Creates a new empty list view, with \fIparent\fR as a parent and \fIname\fR as object name..SH "QListView::~QListView ()"Deletes the list view and all items in it, and frees all allocated resources..SH "int QListView::addColumn ( const QIconSet & iconset, const QString & label, int width = -1 ) \fC[virtual]\fR"Adds a new column at the right end of the widget, with the header \fIlabel\fR and \fIiconset,\fR and returns the index of the column..PPIf \fIwidth\fR is negative, the new column will have WidthMode Maximum, otherwise it will be Manual at \fIwidth\fR pixels wide..PPSee also: setColumnText(), setColumnWidth() and setColumnWidthMode()..PP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -