diff options
Diffstat (limited to 'doc/html/qlistview.html')
-rw-r--r-- | doc/html/qlistview.html | 1231 |
1 files changed, 1231 insertions, 0 deletions
diff --git a/doc/html/qlistview.html b/doc/html/qlistview.html new file mode 100644 index 0000000..020d057 --- /dev/null +++ b/doc/html/qlistview.html @@ -0,0 +1,1231 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qlistview.cpp:2407 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>QListView Class</title> +<style type="text/css"><!-- +fn { margin-left: 1cm; text-indent: -1cm; } +a:link { color: #004faf; text-decoration: none } +a:visited { color: #672967; text-decoration: none } +body { background: #ffffff; color: black; } +--></style> +</head> +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> +<tr bgcolor="#E5E5E5"> +<td valign=center> + <a href="index.html"> +<font color="#004faf">Home</font></a> + | <a href="classes.html"> +<font color="#004faf">All Classes</font></a> + | <a href="mainclasses.html"> +<font color="#004faf">Main Classes</font></a> + | <a href="annotated.html"> +<font color="#004faf">Annotated</font></a> + | <a href="groups.html"> +<font color="#004faf">Grouped Classes</font></a> + | <a href="functions.html"> +<font color="#004faf">Functions</font></a> +</td> +<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QListView Class Reference</h1> + +<p>The QListView class implements a list/tree view. +<a href="#details">More...</a> +<p><tt>#include <<a href="qlistview-h.html">qlistview.h</a>></tt> +<p>Inherits <a href="qscrollview.html">QScrollView</a>. +<p><a href="qlistview-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn><a href="#QListView"><b>QListView</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li> +<li class=fn><a href="#~QListView"><b>~QListView</b></a> ()</li> +<li class=fn>int <a href="#treeStepSize"><b>treeStepSize</b></a> () const</li> +<li class=fn>virtual void <a href="#setTreeStepSize"><b>setTreeStepSize</b></a> ( int )</li> +<li class=fn>virtual void <a href="#insertItem"><b>insertItem</b></a> ( QListViewItem * i )</li> +<li class=fn>virtual void <a href="#takeItem"><b>takeItem</b></a> ( QListViewItem * i )</li> +<li class=fn>virtual void removeItem ( QListViewItem * item ) <em>(obsolete)</em></li> +<li class=fn>QHeader * <a href="#header"><b>header</b></a> () const</li> +<li class=fn>virtual int <a href="#addColumn"><b>addColumn</b></a> ( const QString & label, int width = -1 )</li> +<li class=fn>virtual int <a href="#addColumn-2"><b>addColumn</b></a> ( const QIconSet & iconset, const QString & label, int width = -1 )</li> +<li class=fn>virtual void <a href="#removeColumn"><b>removeColumn</b></a> ( int index )</li> +<li class=fn>virtual void <a href="#setColumnText"><b>setColumnText</b></a> ( int column, const QString & label )</li> +<li class=fn>virtual void <a href="#setColumnText-2"><b>setColumnText</b></a> ( int column, const QIconSet & iconset, const QString & label )</li> +<li class=fn>QString <a href="#columnText"><b>columnText</b></a> ( int c ) const</li> +<li class=fn>virtual void <a href="#setColumnWidth"><b>setColumnWidth</b></a> ( int column, int w )</li> +<li class=fn>int <a href="#columnWidth"><b>columnWidth</b></a> ( int c ) const</li> +<li class=fn>enum <a href="#WidthMode-enum"><b>WidthMode</b></a> { Manual, Maximum }</li> +<li class=fn>virtual void <a href="#setColumnWidthMode"><b>setColumnWidthMode</b></a> ( int c, WidthMode mode )</li> +<li class=fn>WidthMode <a href="#columnWidthMode"><b>columnWidthMode</b></a> ( int c ) const</li> +<li class=fn>int <a href="#columns"><b>columns</b></a> () const</li> +<li class=fn>virtual void <a href="#setColumnAlignment"><b>setColumnAlignment</b></a> ( int column, int align )</li> +<li class=fn>int <a href="#columnAlignment"><b>columnAlignment</b></a> ( int column ) const</li> +<li class=fn>QListViewItem * <a href="#itemAt"><b>itemAt</b></a> ( const QPoint & viewPos ) const</li> +<li class=fn>QRect <a href="#itemRect"><b>itemRect</b></a> ( const QListViewItem * i ) const</li> +<li class=fn>int <a href="#itemPos"><b>itemPos</b></a> ( const QListViewItem * item )</li> +<li class=fn>void <a href="#ensureItemVisible"><b>ensureItemVisible</b></a> ( const QListViewItem * i )</li> +<li class=fn>void <a href="#repaintItem"><b>repaintItem</b></a> ( const QListViewItem * item ) const</li> +<li class=fn>virtual void setMultiSelection ( bool enable ) <em>(obsolete)</em></li> +<li class=fn>bool isMultiSelection () const <em>(obsolete)</em></li> +<li class=fn>enum <a href="#SelectionMode-enum"><b>SelectionMode</b></a> { Single, Multi, Extended, NoSelection }</li> +<li class=fn>void <a href="#setSelectionMode"><b>setSelectionMode</b></a> ( SelectionMode mode )</li> +<li class=fn>SelectionMode <a href="#selectionMode"><b>selectionMode</b></a> () const</li> +<li class=fn>virtual void <a href="#clearSelection"><b>clearSelection</b></a> ()</li> +<li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( QListViewItem * item, bool selected )</li> +<li class=fn>void <a href="#setSelectionAnchor"><b>setSelectionAnchor</b></a> ( QListViewItem * item )</li> +<li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> ( const QListViewItem * i ) const</li> +<li class=fn>QListViewItem * <a href="#selectedItem"><b>selectedItem</b></a> () const</li> +<li class=fn>virtual void <a href="#setOpen"><b>setOpen</b></a> ( QListViewItem * item, bool open )</li> +<li class=fn>bool <a href="#isOpen"><b>isOpen</b></a> ( const QListViewItem * item ) const</li> +<li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( QListViewItem * i )</li> +<li class=fn>QListViewItem * <a href="#currentItem"><b>currentItem</b></a> () const</li> +<li class=fn>QListViewItem * <a href="#firstChild"><b>firstChild</b></a> () const</li> +<li class=fn>QListViewItem * <a href="#lastItem"><b>lastItem</b></a> () const</li> +<li class=fn>int <a href="#childCount"><b>childCount</b></a> () const</li> +<li class=fn>virtual void <a href="#setAllColumnsShowFocus"><b>setAllColumnsShowFocus</b></a> ( bool )</li> +<li class=fn>bool <a href="#allColumnsShowFocus"><b>allColumnsShowFocus</b></a> () const</li> +<li class=fn>virtual void <a href="#setItemMargin"><b>setItemMargin</b></a> ( int )</li> +<li class=fn>int <a href="#itemMargin"><b>itemMargin</b></a> () const</li> +<li class=fn>virtual void <a href="#setRootIsDecorated"><b>setRootIsDecorated</b></a> ( bool )</li> +<li class=fn>bool <a href="#rootIsDecorated"><b>rootIsDecorated</b></a> () const</li> +<li class=fn>virtual void <a href="#setSorting"><b>setSorting</b></a> ( int column, bool ascending = TRUE )</li> +<li class=fn>int <a href="#sortColumn"><b>sortColumn</b></a> () const</li> +<li class=fn>void <a href="#setSortColumn"><b>setSortColumn</b></a> ( int column )</li> +<li class=fn>SortOrder <a href="#sortOrder"><b>sortOrder</b></a> () const</li> +<li class=fn>void <a href="#setSortOrder"><b>setSortOrder</b></a> ( SortOrder order )</li> +<li class=fn>virtual void <a href="#sort"><b>sort</b></a> ()</li> +<li class=fn>virtual bool <a href="#eventFilter"><b>eventFilter</b></a> ( QObject * o, QEvent * e )</li> +<li class=fn>virtual void <a href="#setShowSortIndicator"><b>setShowSortIndicator</b></a> ( bool show )</li> +<li class=fn>bool <a href="#showSortIndicator"><b>showSortIndicator</b></a> () const</li> +<li class=fn>virtual void <a href="#setShowToolTips"><b>setShowToolTips</b></a> ( bool b )</li> +<li class=fn>bool <a href="#showToolTips"><b>showToolTips</b></a> () const</li> +<li class=fn>enum <a href="#ResizeMode-enum"><b>ResizeMode</b></a> { NoColumn, AllColumns, LastColumn }</li> +<li class=fn>virtual void <a href="#setResizeMode"><b>setResizeMode</b></a> ( ResizeMode m )</li> +<li class=fn>ResizeMode <a href="#resizeMode"><b>resizeMode</b></a> () const</li> +<li class=fn>QListViewItem * <a href="#findItem"><b>findItem</b></a> ( const QString & text, int column, ComparisonFlags compare = ExactMatch | CaseSensitive ) const</li> +<li class=fn>enum <a href="#RenameAction-enum"><b>RenameAction</b></a> { Accept, Reject }</li> +<li class=fn>virtual void <a href="#setDefaultRenameAction"><b>setDefaultRenameAction</b></a> ( RenameAction a )</li> +<li class=fn>RenameAction <a href="#defaultRenameAction"><b>defaultRenameAction</b></a> () const</li> +<li class=fn>bool <a href="#isRenaming"><b>isRenaming</b></a> () const</li> +<li class=fn>void <a href="#hideColumn"><b>hideColumn</b></a> ( int column )</li> +</ul> +<h2>Public Slots</h2> +<ul> +<li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li> +<li class=fn>virtual void <a href="#invertSelection"><b>invertSelection</b></a> ()</li> +<li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool select )</li> +<li class=fn>void <a href="#triggerUpdate"><b>triggerUpdate</b></a> ()</li> +<li class=fn>void <a href="#adjustColumn"><b>adjustColumn</b></a> ( int col )</li> +</ul> +<h2>Signals</h2> +<ul> +<li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li> +<li class=fn>void <a href="#selectionChanged-2"><b>selectionChanged</b></a> ( QListViewItem * )</li> +<li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( QListViewItem * )</li> +<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( QListViewItem * item )</li> +<li class=fn>void <a href="#clicked-2"><b>clicked</b></a> ( QListViewItem * item, const QPoint & pnt, int c )</li> +<li class=fn>void <a href="#pressed"><b>pressed</b></a> ( QListViewItem * item )</li> +<li class=fn>void <a href="#pressed-2"><b>pressed</b></a> ( QListViewItem * item, const QPoint & pnt, int c )</li> +<li class=fn>void doubleClicked ( QListViewItem * item ) <em>(obsolete)</em></li> +<li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( QListViewItem *, const QPoint &, int )</li> +<li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ( QListViewItem * )</li> +<li class=fn>void <a href="#spacePressed"><b>spacePressed</b></a> ( QListViewItem * )</li> +<li class=fn>void <a href="#rightButtonClicked"><b>rightButtonClicked</b></a> ( QListViewItem *, const QPoint &, int )</li> +<li class=fn>void <a href="#rightButtonPressed"><b>rightButtonPressed</b></a> ( QListViewItem *, const QPoint &, int )</li> +<li class=fn>void <a href="#mouseButtonPressed"><b>mouseButtonPressed</b></a> ( int button, QListViewItem * item, const QPoint & pos, int c )</li> +<li class=fn>void <a href="#mouseButtonClicked"><b>mouseButtonClicked</b></a> ( int button, QListViewItem * item, const QPoint & pos, int c )</li> +<li class=fn>void <a href="#contextMenuRequested"><b>contextMenuRequested</b></a> ( QListViewItem * item, const QPoint & pos, int col )</li> +<li class=fn>void <a href="#onItem"><b>onItem</b></a> ( QListViewItem * i )</li> +<li class=fn>void <a href="#onViewport"><b>onViewport</b></a> ()</li> +<li class=fn>void <a href="#expanded"><b>expanded</b></a> ( QListViewItem * item )</li> +<li class=fn>void <a href="#collapsed"><b>collapsed</b></a> ( QListViewItem * item )</li> +<li class=fn>void <a href="#dropped"><b>dropped</b></a> ( QDropEvent * e )</li> +<li class=fn>void <a href="#itemRenamed"><b>itemRenamed</b></a> ( QListViewItem * item, int col, const QString & text )</li> +<li class=fn>void <a href="#itemRenamed-2"><b>itemRenamed</b></a> ( QListViewItem * item, int col )</li> +</ul> +<h2>Properties</h2> +<ul> +<li class=fn>bool <a href="#allColumnsShowFocus-prop"><b>allColumnsShowFocus</b></a> - whether items should show keyboard focus using all columns</li> +<li class=fn>int <a href="#childCount-prop"><b>childCount</b></a> - the number of parentless (top-level) QListViewItem objects in this QListView <em>(read only)</em></li> +<li class=fn>int <a href="#columns-prop"><b>columns</b></a> - the number of columns in this list view <em>(read only)</em></li> +<li class=fn>RenameAction <a href="#defaultRenameAction-prop"><b>defaultRenameAction</b></a> - what action to perform when the editor loses focus during renaming</li> +<li class=fn>int <a href="#itemMargin-prop"><b>itemMargin</b></a> - the advisory item margin that list items may use</li> +<li class=fn>bool multiSelection - whether the list view is in multi-selection or extended-selection mode <em>(obsolete)</em></li> +<li class=fn>ResizeMode <a href="#resizeMode-prop"><b>resizeMode</b></a> - whether all, none or the only the last column should be resized</li> +<li class=fn>bool <a href="#rootIsDecorated-prop"><b>rootIsDecorated</b></a> - whether the list view shows open/close signs on root items</li> +<li class=fn>SelectionMode <a href="#selectionMode-prop"><b>selectionMode</b></a> - the list view's selection mode</li> +<li class=fn>bool <a href="#showSortIndicator-prop"><b>showSortIndicator</b></a> - whether the list view header should display a sort indicator</li> +<li class=fn>bool <a href="#showToolTips-prop"><b>showToolTips</b></a> - whether this list view should show tooltips for truncated column texts</li> +<li class=fn>int <a href="#treeStepSize-prop"><b>treeStepSize</b></a> - the number of pixels a child is offset from its parent</li> +</ul> +<h2>Protected Members</h2> +<ul> +<li class=fn>virtual void <a href="#contentsMousePressEvent"><b>contentsMousePressEvent</b></a> ( QMouseEvent * e )</li> +<li class=fn>virtual void <a href="#contentsMouseReleaseEvent"><b>contentsMouseReleaseEvent</b></a> ( QMouseEvent * e )</li> +<li class=fn>virtual void <a href="#contentsMouseMoveEvent"><b>contentsMouseMoveEvent</b></a> ( QMouseEvent * e )</li> +<li class=fn>virtual void <a href="#contentsMouseDoubleClickEvent"><b>contentsMouseDoubleClickEvent</b></a> ( QMouseEvent * e )</li> +<li class=fn>virtual QDragObject * <a href="#dragObject"><b>dragObject</b></a> ()</li> +<li class=fn>virtual void <a href="#startDrag"><b>startDrag</b></a> ()</li> +<li class=fn>virtual void <a href="#resizeEvent"><b>resizeEvent</b></a> ( QResizeEvent * e )</li> +<li class=fn>virtual void <a href="#drawContentsOffset"><b>drawContentsOffset</b></a> ( QPainter * p, int ox, int oy, int cx, int cy, int cw, int ch )</li> +<li class=fn>virtual void <a href="#paintEmptyArea"><b>paintEmptyArea</b></a> ( QPainter * p, const QRect & rect )</li> +</ul> +<h2>Protected Slots</h2> +<ul> +<li class=fn>void <a href="#updateContents"><b>updateContents</b></a> ()</li> +<li class=fn>void <a href="#doAutoScroll"><b>doAutoScroll</b></a> ()</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + +The QListView class implements a list/tree view. +<p> + +<p> It can display and control a hierarchy of multi-column items, and +provides the ability to add new items at any time. The user may +select one or many items (depending on the <a href="#SelectionMode-enum">SelectionMode</a>) and +sort the list in increasing or decreasing order by any column. +<p> The simplest pattern of use is to create a QListView, add some +column headers using <a href="#addColumn">addColumn</a>() and create one or more +<a href="qlistviewitem.html">QListViewItem</a> or <a href="qchecklistitem.html">QCheckListItem</a> objects with the QListView as +parent: +<p> + +<pre> QListView * table; +</pre> + +<pre> table->addColumn( "Qualified name" ); + table->addColumn( "Namespace" ); +</pre><pre> element = new <a href="qlistviewitem.html">QListViewItem</a>( table, qName, namespaceURI ); +</pre> +<p> Further nodes can be added to the list view object (the root of the +tree) or as child nodes to QListViewItems: +<p> <pre> <a name="x2105"></a> for ( int i = 0 ; i < attributes.<a href="qxmlattributes.html#length">length</a>(); i++ ) { + <a name="x2107"></a><a name="x2106"></a> new <a href="qlistviewitem.html">QListViewItem</a>( element, attributes.<a href="qxmlattributes.html#qName">qName</a>(i), attributes.<a href="qxmlattributes.html#uri">uri</a>(i) ); + } +</pre> +<p> (From <a href="tagreader-with-features-example.html">xml/tagreader-with-features/structureparser.cpp</a>) +<p> The main setup functions are: +<center><table cellpadding="4" cellspacing="2" border="0"> +<tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Action +<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#addColumn">addColumn</a>() +<td valign="top">Adds a column with a text label and perhaps width. Columns +are counted from the left starting with column 0. +<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#setColumnWidthMode">setColumnWidthMode</a>() +<td valign="top">Sets the column to be resized automatically or not. +<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#setAllColumnsShowFocus">setAllColumnsShowFocus</a>() +<td valign="top">Sets whether items should show <a href="focus.html#keyboard-focus">keyboard focus</a> using all +columns or just column 0. The default is to show focus +just using column 0. +<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#setRootIsDecorated">setRootIsDecorated</a>() +<td valign="top">Sets whether root items should show open/close decoration to their left. +The default is FALSE. +<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#setTreeStepSize">setTreeStepSize</a>() +<td valign="top">Sets how many pixels an item's children are indented +relative to their parent. The default is 20. This is +mostly a matter of taste. +<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#setSorting">setSorting</a>() +<td valign="top">Sets whether the items should be sorted, whether it should +be in ascending or descending order, and by what column +they should be sorted. By default the list view is sorted +by the first column; to switch this off call <a href="#setSorting">setSorting</a>(-1). +</table></center> +<p> To handle events such as mouse presses on the list view, derived +classes can reimplement the <a href="qscrollview.html">QScrollView</a> functions: +<a href="qscrollview.html#contentsMousePressEvent">contentsMousePressEvent</a>, +<a href="qscrollview.html#contentsMouseReleaseEvent">contentsMouseReleaseEvent</a>, +<a href="qscrollview.html#contentsMouseDoubleClickEvent">contentsMouseDoubleClickEvent</a>, +<a href="qscrollview.html#contentsMouseMoveEvent">contentsMouseMoveEvent</a>, +<a href="qscrollview.html#contentsDragEnterEvent">contentsDragEnterEvent</a>, +<a href="qscrollview.html#contentsDragMoveEvent">contentsDragMoveEvent</a>, +<a href="qscrollview.html#contentsDragLeaveEvent">contentsDragLeaveEvent</a>, +<a href="qscrollview.html#contentsDropEvent">contentsDropEvent</a>, and +<a href="qscrollview.html#contentsWheelEvent">contentsWheelEvent</a>. +<p> There are also several functions for mapping between items and +coordinates. <a href="#itemAt">itemAt</a>() returns the item at a position on-screen, +<a href="#itemRect">itemRect</a>() returns the rectangle an item occupies on the screen, +and <a href="#itemPos">itemPos</a>() returns the position of any item (whether it is +on-screen or not). <a href="#firstChild">firstChild</a>() returns the list view's first item +(not necessarily visible on-screen). +<p> You can iterate over visible items using +<a href="qlistviewitem.html#itemBelow">QListViewItem::itemBelow</a>(); over a list view's top-level items +using <a href="qlistviewitem.html#firstChild">QListViewItem::firstChild</a>() and +<a href="qlistviewitem.html#nextSibling">QListViewItem::nextSibling</a>(); or every item using a +<a href="qlistviewitemiterator.html">QListViewItemIterator</a>. See +the <a href="qlistviewitem.html">QListViewItem</a> documentation for examples of traversal. +<p> An item can be moved amongst its siblings using +<a href="qlistviewitem.html#moveItem">QListViewItem::moveItem</a>(). To move an item in the hierarchy use +<a href="#takeItem">takeItem</a>() and <a href="#insertItem">insertItem</a>(). Item's (and all their child items) +are deleted with <tt>delete</tt>; to delete all the list view's items +use <a href="#clear">clear</a>(). +<p> There are a variety of selection modes described in the +QListView::SelectionMode documentation. The default is <a href="#SelectionMode-enum">Single</a> +selection, which you can change using <a href="#setSelectionMode">setSelectionMode</a>(). +<p> Because QListView offers multiple selection it must display +keyboard focus and selection state separately. Therefore there are +functions both to set the selection state of an item +(<a href="#setSelected">setSelected</a>()) and to set which item displays keyboard focus +(<a href="#setCurrentItem">setCurrentItem</a>()). +<p> QListView emits two groups of signals; one group signals changes +in selection/focus state and one indicates selection. The first +group consists of <a href="#selectionChanged">selectionChanged</a>() (applicable to all list +views), selectionChanged(<a href="qlistviewitem.html">QListViewItem</a>*) (applicable only to a +<a href="#SelectionMode-enum">Single</a> selection list view), and <a href="#currentChanged">currentChanged</a>(QListViewItem*). +The second group consists of <a href="#doubleClicked">doubleClicked</a>(QListViewItem*), +<a href="#returnPressed">returnPressed</a>(QListViewItem*), +<a href="#rightButtonClicked">rightButtonClicked</a>(QListViewItem*, const <a href="qpoint.html">QPoint</a>&, int), etc. +<p> Note that changing the state of the list view in a slot connected +to a list view signal may cause unexpected side effects. If you +need to change the list view's state in response to a signal, use +a <a href="qtimer.html#singleShot">single shot timer</a> with a +time out of 0, and connect this timer to a slot that modifies the +list view's state. +<p> In <a href="motif-extension.html#Motif">Motif</a> 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. +<p> If <a href="#selectionMode">selectionMode</a>() is <a href="#SelectionMode-enum">Single</a> (the default) the user can select +one item at a time, e.g. by clicking an item with the mouse, see +<a href="#SelectionMode-enum">QListView::SelectionMode</a> for details. +<p> The list view can be navigated either using the mouse or the +keyboard. Clicking a <b>-</b> icon closes an item (hides its +children) and clicking a <b>+</b> icon opens an item (shows its +children). The keyboard controls are these: +<center><table cellpadding="4" cellspacing="2" border="0"> +<tr bgcolor="#a2c511"> <th valign="top">Keypress <th valign="top">Action +<tr bgcolor="#f0f0f0"> <td valign="top">Home +<td valign="top">Make the first item current and visible. +<tr bgcolor="#d0d0d0"> <td valign="top">End +<td valign="top">Make the last item current and visible. +<tr bgcolor="#f0f0f0"> <td valign="top">Page Up +<td valign="top">Make the item above the top visible item current and visible. +<tr bgcolor="#d0d0d0"> <td valign="top">Page Down +<td valign="top">Make the item below the bottom visible item current and visible. +<tr bgcolor="#f0f0f0"> <td valign="top">Up Arrow +<td valign="top">Make the item above the current item current and visible. +<tr bgcolor="#d0d0d0"> <td valign="top">Down Arrow +<td valign="top">Make the item below the current item current and visible. +<tr bgcolor="#f0f0f0"> <td valign="top">Left Arrow +<td valign="top">If the current item is closed (<b>+</b> icon) or has no +children, make its parent item current and visible. If the +current item is open (<b>-</b> icon) close it, i.e. hide its +children. Exception: if the current item is the first item +and is closed and the horizontal scrollbar is offset to +the right the list view will be scrolled left. +<tr bgcolor="#d0d0d0"> <td valign="top">Right Arrow +<td valign="top">If the current item is closed (<b>+</b> icon) and has +children, the item is opened. If the current item is +opened (<b>-</b> icon) and has children the item's first +child is made current and visible. If the current item has +no children the list view is scrolled right. +</table></center> +<p> If the user starts typing letters with the focus in the list view +an incremental search will occur. For example if the user types +'d' the current item will change to the first item that begins +with the letter 'd'; if they then type 'a', the current item will +change to the first item that begins with 'da', and so on. If no +item begins with the letters they type the current item doesn't +change. +<p> <b>Warning:</b> The list view assumes ownership of all list view items +and will delete them when it does not need them any more. +<p> <img src=qlistview-m.png> <img src=qlistview-w.png> +<p> <p>See also <a href="qlistviewitem.html">QListViewItem</a>, <a href="qchecklistitem.html">QCheckListItem</a>, and <a href="advanced.html">Advanced Widgets</a>. + +<hr><h2>Member Type Documentation</h2> +<h3 class=fn><a name="RenameAction-enum"></a>QListView::RenameAction</h3> + +<p> This enum describes whether a rename operation is accepted if the +rename editor loses focus without the user pressing Enter. +<ul> +<li><tt>QListView::Accept</tt> - Rename if Enter is pressed or focus is lost. +<li><tt>QListView::Reject</tt> - Discard the rename operation if focus is lost (and +Enter has not been pressed). +</ul> +<h3 class=fn><a name="ResizeMode-enum"></a>QListView::ResizeMode</h3> + +<p> This enum describes how the list view's header adjusts to resize +events which affect the width of the list view. +<ul> +<li><tt>QListView::NoColumn</tt> - The columns do not get resized in resize events. +<li><tt>QListView::AllColumns</tt> - All columns are resized equally to fit the width +of the list view. +<li><tt>QListView::LastColumn</tt> - The last column is resized to fit the width of +the list view. +</ul> +<h3 class=fn><a name="SelectionMode-enum"></a>QListView::SelectionMode</h3> + +<p> This enumerated type is used by QListView to indicate how it +reacts to selection by the user. +<ul> +<li><tt>QListView::Single</tt> - When the user selects an item, any already-selected +item becomes unselected. The user can unselect the selected +item by clicking on some empty space within the view. +<li><tt>QListView::Multi</tt> - When the user selects an item in the usual way, the +selection status of that item is toggled and the other items are +left alone. Also, multiple items can be selected by dragging the +mouse while the left mouse button stays pressed. +<li><tt>QListView::Extended</tt> - When the user selects an item in the usual way, +the selection is cleared and the new item selected. However, if +the user presses the Ctrl key when clicking on an item, the +clicked item gets toggled and all other items are left untouched. +And if the user presses the Shift key while clicking on an item, +all items between the current item and the clicked item get +selected or unselected, depending on the state of the clicked +item. Also, multiple items can be selected by dragging the mouse +over them. +<li><tt>QListView::NoSelection</tt> - Items cannot be selected. +</ul><p> In other words, <a href="#SelectionMode-enum">Single</a> is a real single-selection list view, <a href="#SelectionMode-enum">Multi</a> a real multi-selection list view, <a href="#SelectionMode-enum">Extended</a> is a list view +where users can select multiple items but usually want to select +either just one or a range of contiguous items, and <a href="#SelectionMode-enum">NoSelection</a> +is a list view where the user can look but not touch. + +<h3 class=fn><a name="WidthMode-enum"></a>QListView::WidthMode</h3> + +<p> This enum type describes how the width of a column in the view +changes. +<ul> +<li><tt>QListView::Manual</tt> - the column width does not change automatically. +<li><tt>QListView::Maximum</tt> - the column is automatically sized according to the +widths of all items in the column. (Note: The column never shrinks +in this case.) This means that the column is always resized to the +width of the item with the largest width in the column. +</ul><p> <p>See also <a href="#setColumnWidth">setColumnWidth</a>(), <a href="#setColumnWidthMode">setColumnWidthMode</a>(), and <a href="#columnWidth">columnWidth</a>(). + +<hr><h2>Member Function Documentation</h2> +<h3 class=fn><a name="QListView"></a>QListView::QListView ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 ) +</h3> +Constructs a new empty list view called <em>name</em> with parent <em>parent</em>. +<p> Performance is boosted by modifying the widget flags <em>f</em> so that +only part of the <a href="qlistviewitem.html">QListViewItem</a> children is redrawn. This may be +unsuitable for custom QListViewItem classes, in which case <a href="qt.html#WidgetFlags-enum">WStaticContents</a> and <a href="qt.html#WidgetFlags-enum">WNoAutoErase</a> should be cleared. +<p> <p>See also <a href="qwidget.html#clearWFlags">QWidget::clearWFlags</a>() and <a href="qt.html#WidgetFlags-enum">Qt::WidgetFlags</a>. + +<h3 class=fn><a name="~QListView"></a>QListView::~QListView () +</h3> +Destroys the list view, deleting all its items, and frees up all +allocated resources. + +<h3 class=fn>int <a name="addColumn"></a>QListView::addColumn ( const <a href="qstring.html">QString</a> & label, int width = -1 )<tt> [virtual]</tt> +</h3> +Adds a <em>width</em> pixels wide column with the column header <em>label</em> +to the list view, and returns the index of the new column. +<p> All columns apart from the first one are inserted to the right of +the existing ones. +<p> If <em>width</em> is negative, the new column's <a href="#WidthMode-enum">WidthMode</a> is set to +<a href="#WidthMode-enum">Maximum</a> instead of <a href="#WidthMode-enum">Manual</a>. +<p> <p>See also <a href="#setColumnText">setColumnText</a>(), <a href="#setColumnWidth">setColumnWidth</a>(), and <a href="#setColumnWidthMode">setColumnWidthMode</a>(). + +<p>Examples: <a href="addressbook-example.html#x585">addressbook/centralwidget.cpp</a>, <a href="checklists-example.html#x427">checklists/checklists.cpp</a>, <a href="dirview-example.html#x1714">dirview/main.cpp</a>, <a href="fileiconview-example.html#x886">fileiconview/mainwindow.cpp</a>, <a href="listviews-example.html#x141">listviews/listviews.cpp</a>, and <a href="qdir-example.html#x1827">qdir/qdir.cpp</a>. +<h3 class=fn>int <a name="addColumn-2"></a>QListView::addColumn ( const <a href="qiconset.html">QIconSet</a> & iconset, const <a href="qstring.html">QString</a> & label, int width = -1 )<tt> [virtual]</tt> +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Adds a <em>width</em> pixels wide new column with the header <em>label</em> +and the <em>iconset</em> to the list view, and returns the index of the +column. +<p> If <em>width</em> is negative, the new column's <a href="#WidthMode-enum">WidthMode</a> is set to +<a href="#WidthMode-enum">Maximum</a>, and to <a href="#WidthMode-enum">Manual</a> otherwise. +<p> <p>See also <a href="#setColumnText">setColumnText</a>(), <a href="#setColumnWidth">setColumnWidth</a>(), and <a href="#setColumnWidthMode">setColumnWidthMode</a>(). + +<h3 class=fn>void <a name="adjustColumn"></a>QListView::adjustColumn ( int col )<tt> [slot]</tt> +</h3> Adjusts the column <em>col</em> to its preferred width +<h3 class=fn>bool <a name="allColumnsShowFocus"></a>QListView::allColumnsShowFocus () const +</h3><p>Returns TRUE if items should show keyboard focus using all columns; otherwise returns FALSE. +See the <a href="qlistview.html#allColumnsShowFocus-prop">"allColumnsShowFocus"</a> property for details. +<h3 class=fn>int <a name="childCount"></a>QListView::childCount () const +</h3><p>Returns the number of parentless (top-level) <a href="qlistviewitem.html">QListViewItem</a> objects in this QListView. +See the <a href="qlistview.html#childCount-prop">"childCount"</a> property for details. +<h3 class=fn>void <a name="clear"></a>QListView::clear ()<tt> [virtual slot]</tt> +</h3> +Removes and deletes all the items in this list view and triggers +an update. +<p> Note that the <a href="#currentChanged">currentChanged</a>() signal is not emitted when this slot is invoked. +<p>See also <a href="#triggerUpdate">triggerUpdate</a>(). + +<p>Examples: <a href="addressbook-example.html#x586">addressbook/centralwidget.cpp</a>, <a href="checklists-example.html#x428">checklists/checklists.cpp</a>, <a href="listviews-example.html#x142">listviews/listviews.cpp</a>, and <a href="qaxcontainer-example-qutlook.html#x2725">qutlook/centralwidget.cpp</a>. +<h3 class=fn>void <a name="clearSelection"></a>QListView::clearSelection ()<tt> [virtual]</tt> +</h3> +Sets all the items to be not selected, updates the list view as +necessary, and emits the <a href="#selectionChanged">selectionChanged</a>() signals. Note that for +<a href="#SelectionMode-enum">Multi</a> selection list views this function needs to iterate over +<em>all</em> items. +<p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="#multiSelection-prop">multiSelection</a>. + +<p>Example: <a href="addressbook-example.html#x587">addressbook/centralwidget.cpp</a>. +<h3 class=fn>void <a name="clicked"></a>QListView::clicked ( <a href="qlistviewitem.html">QListViewItem</a> * item )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted whenever the user clicks (mouse pressed <em>and</em> mouse released) in the list view. <em>item</em> is the clicked list +view item, or 0 if the user didn't click on an item. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. + +<p>Example: <a href="addressbook-example.html#x588">addressbook/centralwidget.cpp</a>. +<h3 class=fn>void <a name="clicked-2"></a>QListView::clicked ( <a href="qlistviewitem.html">QListViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pnt, int c )<tt> [signal]</tt> +</h3> + +<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> This signal is emitted whenever the user clicks (mouse pressed <em>and</em> mouse released) in the list view. <em>item</em> is the clicked list +view item, or 0 if the user didn't click on an item. <em>pnt</em> is the +position where the user has clicked in global coordinates. If <em>item</em> is not 0, <em>c</em> is the list view column into which the user +pressed; if <em>item</em> is 0 <em>c</em>'s value is undefined. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. + +<h3 class=fn>void <a name="collapsed"></a>QListView::collapsed ( <a href="qlistviewitem.html">QListViewItem</a> * item )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when the <em>item</em> has been collapsed, i.e. +when the children of <em>item</em> are hidden. +<p> <p>See also <a href="#setOpen">setOpen</a>() and <a href="#expanded">expanded</a>(). + +<h3 class=fn>int <a name="columnAlignment"></a>QListView::columnAlignment ( int column ) const +</h3> +Returns the alignment of column <em>column</em>. The default is <a href="qt.html#AlignmentFlags-enum">AlignAuto</a>. +<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>. + +<h3 class=fn><a href="qstring.html">QString</a> <a name="columnText"></a>QListView::columnText ( int c ) const +</h3> +Returns the text of column <em>c</em>. +<p> <p>See also <a href="#setColumnText">setColumnText</a>(). + +<h3 class=fn>int <a name="columnWidth"></a>QListView::columnWidth ( int c ) const +</h3> +Returns the width of column <em>c</em>. +<p> <p>See also <a href="#setColumnWidth">setColumnWidth</a>(). + +<h3 class=fn><a href="qlistview.html#WidthMode-enum">WidthMode</a> <a name="columnWidthMode"></a>QListView::columnWidthMode ( int c ) const +</h3> +Returns the <a href="#WidthMode-enum">WidthMode</a> for column <em>c</em>. +<p> <p>See also <a href="#setColumnWidthMode">setColumnWidthMode</a>(). + +<h3 class=fn>int <a name="columns"></a>QListView::columns () const +</h3><p>Returns the number of columns in this list view. +See the <a href="qlistview.html#columns-prop">"columns"</a> property for details. +<h3 class=fn>void <a name="contentsMouseDoubleClickEvent"></a>QListView::contentsMouseDoubleClickEvent ( <a href="qmouseevent.html">QMouseEvent</a> * e )<tt> [virtual protected]</tt> +</h3> +Processes the mouse double-click event <em>e</em> on behalf of the viewed widget. + +<p>Reimplemented from <a href="qscrollview.html#contentsMouseDoubleClickEvent">QScrollView</a>. +<h3 class=fn>void <a name="contentsMouseMoveEvent"></a>QListView::contentsMouseMoveEvent ( <a href="qmouseevent.html">QMouseEvent</a> * e )<tt> [virtual protected]</tt> +</h3> +Processes the mouse move event <em>e</em> on behalf of the viewed widget. + +<p>Example: <a href="dirview-example.html#x1683">dirview/dirview.cpp</a>. +<p>Reimplemented from <a href="qscrollview.html#contentsMouseMoveEvent">QScrollView</a>. +<h3 class=fn>void <a name="contentsMousePressEvent"></a>QListView::contentsMousePressEvent ( <a href="qmouseevent.html">QMouseEvent</a> * e )<tt> [virtual protected]</tt> +</h3> +Processes the mouse press event <em>e</em> on behalf of the viewed widget. + +<p>Example: <a href="dirview-example.html#x1684">dirview/dirview.cpp</a>. +<p>Reimplemented from <a href="qscrollview.html#contentsMousePressEvent">QScrollView</a>. +<h3 class=fn>void <a name="contentsMouseReleaseEvent"></a>QListView::contentsMouseReleaseEvent ( <a href="qmouseevent.html">QMouseEvent</a> * e )<tt> [virtual protected]</tt> +</h3> +Processes the mouse release event <em>e</em> on behalf of the viewed widget. + +<p>Example: <a href="dirview-example.html#x1685">dirview/dirview.cpp</a>. +<p>Reimplemented from <a href="qscrollview.html#contentsMouseReleaseEvent">QScrollView</a>. +<h3 class=fn>void <a name="contextMenuRequested"></a>QListView::contextMenuRequested ( <a href="qlistviewitem.html">QListViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos, int col )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when the user invokes a context menu with +the right mouse button or with special system keys. If the +keyboard was used <em>item</em> is the current item; if the mouse was +used, <em>item</em> is the item under the mouse pointer or 0 if there is +no item under the mouse pointer. If no item is clicked, the column +index emitted is -1. +<p> <em>pos</em> is the position for the context menu in the global +coordinate system. +<p> <em>col</em> is the column on which the user pressed, or -1 if the +signal was triggered by a key event. + +<p>Example: <a href="listviews-example.html#x143">listviews/listviews.cpp</a>. +<h3 class=fn>void <a name="currentChanged"></a>QListView::currentChanged ( <a href="qlistviewitem.html">QListViewItem</a> * )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted whenever the current item has changed +(normally after the screen update). The current item is the item +responsible for indicating <a href="focus.html#keyboard-focus">keyboard focus</a>. +<p> The argument is the newly current item, or 0 if the change made no +item current. This can happen, for example, if all items in the +list view are deleted. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. +<p> <p>See also <a href="#setCurrentItem">setCurrentItem</a>() and <a href="#currentItem">currentItem</a>(). + +<p>Example: <a href="listviews-example.html#x144">listviews/listviews.cpp</a>. +<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="currentItem"></a>QListView::currentItem () const +</h3> +Returns the current item, or 0 if there isn't one. +<p> <p>See also <a href="#setCurrentItem">setCurrentItem</a>(). + +<p>Examples: <a href="addressbook-example.html#x589">addressbook/centralwidget.cpp</a>, <a href="listviews-example.html#x145">listviews/listviews.cpp</a>, and <a href="qaxcontainer-example-qutlook.html#x2726">qutlook/centralwidget.cpp</a>. +<h3 class=fn><a href="qlistview.html#RenameAction-enum">RenameAction</a> <a name="defaultRenameAction"></a>QListView::defaultRenameAction () const +</h3><p>Returns what action to perform when the editor loses focus during renaming. +See the <a href="qlistview.html#defaultRenameAction-prop">"defaultRenameAction"</a> property for details. +<h3 class=fn>void <a name="doAutoScroll"></a>QListView::doAutoScroll ()<tt> [protected slot]</tt> +</h3> +This slot handles auto-scrolling when the mouse button is pressed +and the mouse is outside the widget. + +<h3 class=fn>void <a name="doubleClicked"></a>QListView::doubleClicked ( <a href="qlistviewitem.html">QListViewItem</a> *, const <a href="qpoint.html">QPoint</a> &, int )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted whenever an item is double-clicked. It's +emitted on the second button press, not the second button release. +The arguments are the relevant <a href="qlistviewitem.html">QListViewItem</a> (may be 0), the point +in global coordinates and the relevant column (or -1 if the click +was outside the list). +<p> <b>Warning:</b> Do not delete any QListViewItem objects in slots +connected to this signal. + +<h3 class=fn>void <a name="doubleClicked-2"></a>QListView::doubleClicked ( <a href="qlistviewitem.html">QListViewItem</a> * item )<tt> [signal]</tt> +</h3> + +<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. +(use <a href="#doubleClicked">doubleClicked</a>( <a href="qlistviewitem.html">QListViewItem</a> *, const <a href="qpoint.html">QPoint</a>&, int )) +<p> This signal is emitted whenever an item is double-clicked. It's +emitted on the second button press, not the second button release. +<em>item</em> is the list view item on which the user did the +double-click. + +<h3 class=fn><a href="qdragobject.html">QDragObject</a> * <a name="dragObject"></a>QListView::dragObject ()<tt> [virtual protected]</tt> +</h3> +If the user presses the mouse on an item and starts moving the +mouse, and the item allow dragging (see +<a href="qlistviewitem.html#setDragEnabled">QListViewItem::setDragEnabled</a>()), this function is called to get a +drag object and a drag is started unless <a href="#dragObject">dragObject</a>() returns 0. +<p> By default this function returns 0. You should reimplement it and +create a <a href="qdragobject.html">QDragObject</a> depending on the selected items. + +<h3 class=fn>void <a name="drawContentsOffset"></a>QListView::drawContentsOffset ( <a href="qpainter.html">QPainter</a> * p, int ox, int oy, int cx, int cy, int cw, int ch )<tt> [virtual protected]</tt> +</h3> +Calls <a href="qlistviewitem.html#paintCell">QListViewItem::paintCell</a>() and +<a href="qlistviewitem.html#paintBranches">QListViewItem::paintBranches</a>() as necessary for all list view +items that require repainting in the <em>cw</em> pixels wide and <em>ch</em> +pixels high bounding rectangle starting at position <em>cx</em>, <em>cy</em> +with offset <em>ox</em>, <em>oy</em>. Uses the painter <em>p</em>. + +<p>Reimplemented from <a href="qscrollview.html#drawContentsOffset">QScrollView</a>. +<h3 class=fn>void <a name="dropped"></a>QListView::dropped ( <a href="qdropevent.html">QDropEvent</a> * e )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted, when a drop event occurred on the +viewport (not onto an item). +<p> <em>e</em> provides all the information about the drop. + +<h3 class=fn>void <a name="ensureItemVisible"></a>QListView::ensureItemVisible ( const <a href="qlistviewitem.html">QListViewItem</a> * i ) +</h3> +Ensures that item <em>i</em> is visible, scrolling the list view +vertically if necessary and opening (expanding) any parent items +if this is required to show the item. +<p> <p>See also <a href="#itemRect">itemRect</a>() and <a href="qscrollview.html#ensureVisible">QScrollView::ensureVisible</a>(). + +<h3 class=fn>bool <a name="eventFilter"></a>QListView::eventFilter ( <a href="qobject.html">QObject</a> * o, <a href="qevent.html">QEvent</a> * e )<tt> [virtual]</tt> +</h3> +Redirects the event <em>e</em> relating to object <em>o</em>, for the viewport +to <a href="qwidget.html#mousePressEvent">mousePressEvent</a>(), <a href="qwidget.html#keyPressEvent">keyPressEvent</a>() and friends. + +<p>Reimplemented from <a href="qscrollview.html#eventFilter">QScrollView</a>. +<h3 class=fn>void <a name="expanded"></a>QListView::expanded ( <a href="qlistviewitem.html">QListViewItem</a> * item )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when <em>item</em> has been expanded, i.e. when +the children of <em>item</em> are shown. +<p> <p>See also <a href="#setOpen">setOpen</a>() and <a href="#collapsed">collapsed</a>(). + +<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="findItem"></a>QListView::findItem ( const <a href="qstring.html">QString</a> & text, int column, ComparisonFlags compare = ExactMatch | CaseSensitive ) const +</h3> +Finds the first list view item in column <em>column</em>, that matches +<em>text</em> and returns the item, or returns 0 of no such item could +be found. +The search starts from the current item if the current item exists, +otherwise it starts from the first list view item. After reaching +the last item the search continues from the first item. +Pass OR-ed together <a href="qt.html#StringComparisonMode-enum">Qt::StringComparisonMode</a> values +in the <em>compare</em> flag, to control how the matching is performed. +The default comparison mode is case-sensitive, exact match. + +<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="firstChild"></a>QListView::firstChild () const +</h3> +Returns the first item in this QListView. Returns 0 if there is no +first item. +<p> A list view's items can be traversed using <a href="#firstChild">firstChild</a>() +and nextSibling() or using a <a href="qlistviewitemiterator.html">QListViewItemIterator</a>. +<p> <p>See also <a href="#itemAt">itemAt</a>(), <a href="qlistviewitem.html#itemBelow">QListViewItem::itemBelow</a>(), and <a href="qlistviewitem.html#itemAbove">QListViewItem::itemAbove</a>(). + +<p>Examples: <a href="addressbook-example.html#x590">addressbook/centralwidget.cpp</a> and <a href="listviews-example.html#x146">listviews/listviews.cpp</a>. +<h3 class=fn><a href="qheader.html">QHeader</a> * <a name="header"></a>QListView::header () const +</h3> +Returns the <a href="qheader.html">QHeader</a> object that manages this list view's columns. +Please don't modify the header behind the list view's back. +<p> You may safely call <a href="qheader.html#setClickEnabled">QHeader::setClickEnabled</a>(), +<a href="qheader.html#setResizeEnabled">QHeader::setResizeEnabled</a>(), <a href="qheader.html#setMovingEnabled">QHeader::setMovingEnabled</a>(), +<a href="qwidget.html#hide">QHeader::hide</a>() and all the const QHeader functions. + +<p>Examples: <a href="listviews-example.html#x147">listviews/listviews.cpp</a> and <a href="qdir-example.html#x1828">qdir/qdir.cpp</a>. +<h3 class=fn>void <a name="hideColumn"></a>QListView::hideColumn ( int column ) +</h3> +Hides the column specified at <em>column</em>. This is a convenience +function that calls <a href="#setColumnWidth">setColumnWidth</a>( <em>column</em>, 0 ). +<p> Note: The user may still be able to resize the hidden column using +the header handles. To prevent this, call setResizeEnabled(FALSE, +<em>column</em>) on the list views header. +<p> <p>See also <a href="#setColumnWidth">setColumnWidth</a>(). + +<h3 class=fn>void <a name="insertItem"></a>QListView::insertItem ( <a href="qlistviewitem.html">QListViewItem</a> * i )<tt> [virtual]</tt> +</h3> +Inserts item <em>i</em> into the list view as a top-level item. You do +not need to call this unless you've called <a href="#takeItem">takeItem</a>(<em>i</em>) or +<a href="qlistviewitem.html#takeItem">QListViewItem::takeItem</a>(<em>i</em>) and need to reinsert <em>i</em> elsewhere. +<p> <p>See also <a href="qlistviewitem.html#takeItem">QListViewItem::takeItem</a>() and <a href="#takeItem">takeItem</a>(). + +<h3 class=fn>void <a name="invertSelection"></a>QListView::invertSelection ()<tt> [virtual slot]</tt> +</h3> +Inverts the selection. Only works in <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a> +selection modes. + +<h3 class=fn>bool <a name="isMultiSelection"></a>QListView::isMultiSelection () const +</h3><p>Returns TRUE if the list view is in multi-selection or extended-selection mode; otherwise returns FALSE. +See the <a href="qlistview.html#multiSelection-prop">"multiSelection"</a> property for details. +<h3 class=fn>bool <a name="isOpen"></a>QListView::isOpen ( const <a href="qlistviewitem.html">QListViewItem</a> * item ) const +</h3> +Identical to <em>item</em>->isOpen(). Provided for completeness. +<p> <p>See also <a href="#setOpen">setOpen</a>(). + +<h3 class=fn>bool <a name="isRenaming"></a>QListView::isRenaming () const +</h3> +Returns TRUE if an item is being renamed; otherwise returns FALSE. + +<h3 class=fn>bool <a name="isSelected"></a>QListView::isSelected ( const <a href="qlistviewitem.html">QListViewItem</a> * i ) const +</h3> +Returns TRUE if the list view item <em>i</em> is selected; otherwise +returns FALSE. +<p> <p>See also <a href="qlistviewitem.html#isSelected">QListViewItem::isSelected</a>(). + +<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="itemAt"></a>QListView::itemAt ( const <a href="qpoint.html">QPoint</a> & viewPos ) const +</h3> +Returns the list view item at <em>viewPos</em>. Note that <em>viewPos</em> is +in the <a href="qscrollview.html#viewport">viewport</a>()'s coordinate system, not in the list view's own, +much larger, coordinate system. +<p> <a href="#itemAt">itemAt</a>() returns 0 if there is no such item. +<p> Note that you also get the pointer to the item if <em>viewPos</em> +points to the root decoration (see <a href="#setRootIsDecorated">setRootIsDecorated</a>()) of the +item. To check whether or not <em>viewPos</em> is on the root decoration +of the item, you can do something like this: +<p> <pre> + <a href="qlistviewitem.html">QListViewItem</a> *i = <a href="#itemAt">itemAt</a>( p ); + if ( i ) { + if ( p.x() > header()->sectionPos( <a href="#header">header</a>()->mapToIndex( 0 ) ) + + <a href="#treeStepSize">treeStepSize</a>() * ( i-><a href="qlistviewitem.html#depth">depth</a>() + ( <a href="#rootIsDecorated">rootIsDecorated</a>() ? 1 : 0) ) + itemMargin() || + p.x() < header()->sectionPos( <a href="#header">header</a>()->mapToIndex( 0 ) ) ) { + ; // p is not on root decoration + else + ; // p is on the root decoration + } + </pre> + +<p> This might be interesting if you use this function to find out +where the user clicked and if you want to start a drag (which you +do not want to do if the user clicked onto the root decoration of +an item). +<p> <p>See also <a href="#itemPos">itemPos</a>(), <a href="#itemRect">itemRect</a>(), and <a href="qscrollview.html#viewportToContents">viewportToContents</a>(). + +<h3 class=fn>int <a name="itemMargin"></a>QListView::itemMargin () const +</h3><p>Returns the advisory item margin that list items may use. +See the <a href="qlistview.html#itemMargin-prop">"itemMargin"</a> property for details. +<h3 class=fn>int <a name="itemPos"></a>QListView::itemPos ( const <a href="qlistviewitem.html">QListViewItem</a> * item ) +</h3> +Returns the y-coordinate of <em>item</em> in the list view's coordinate +system. This function is normally much slower than <a href="#itemAt">itemAt</a>() but it +works for all items, whereas itemAt() normally works only for +items on the screen. +<p> This is a thin wrapper around <a href="qlistviewitem.html#itemPos">QListViewItem::itemPos</a>(). +<p> <p>See also <a href="#itemAt">itemAt</a>() and <a href="#itemRect">itemRect</a>(). + +<h3 class=fn><a href="qrect.html">QRect</a> <a name="itemRect"></a>QListView::itemRect ( const <a href="qlistviewitem.html">QListViewItem</a> * i ) const +</h3> +Returns the rectangle on the screen that item <em>i</em> occupies in +<a href="qscrollview.html#viewport">viewport</a>()'s coordinates, or an invalid rectangle if <em>i</em> is 0 or +is not currently visible. +<p> The rectangle returned does not include any children of the +rectangle (i.e. it uses <a href="qlistviewitem.html#height">QListViewItem::height</a>(), rather than +<a href="qlistviewitem.html#totalHeight">QListViewItem::totalHeight</a>()). If you want the rectangle to +include children you can use something like this: +<p> <pre> + <a href="qrect.html">QRect</a> r( listView->itemRect( item ) ); + r.<a href="qrect.html#setHeight">setHeight</a>( (QCOORD)(QMIN( item->totalHeight(), + listView->viewport->height() - r.<a href="qrect.html#y">y</a>() ) ) ) + </pre> + +<p> Note the way it avoids too-high rectangles. totalHeight() can be +much larger than the window system's coordinate system allows. +<p> <a href="#itemRect">itemRect</a>() is comparatively slow. It's best to call it only for +items that are probably on-screen. + +<h3 class=fn>void <a name="itemRenamed"></a>QListView::itemRenamed ( <a href="qlistviewitem.html">QListViewItem</a> * item, int col, const <a href="qstring.html">QString</a> & text )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when <em>item</em> has been renamed to <em>text</em>, +e.g. by in in-place renaming, in column <em>col</em>. +<p> <p>See also <a href="qlistviewitem.html#setRenameEnabled">QListViewItem::setRenameEnabled</a>(). + +<h3 class=fn>void <a name="itemRenamed-2"></a>QListView::itemRenamed ( <a href="qlistviewitem.html">QListViewItem</a> * item, int col )<tt> [signal]</tt> +</h3> + +<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> This signal is emitted when <em>item</em> has been renamed, e.g. by +in-place renaming, in column <em>col</em>. +<p> <p>See also <a href="qlistviewitem.html#setRenameEnabled">QListViewItem::setRenameEnabled</a>(). + +<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="lastItem"></a>QListView::lastItem () const +</h3> +Returns the last item in the list view tree. Returns 0 if there +are no items in the QListView. +<p> This function is slow because it traverses the entire tree to find +the last item. + +<h3 class=fn>void <a name="mouseButtonClicked"></a>QListView::mouseButtonClicked ( int button, <a href="qlistviewitem.html">QListViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos, int c )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted whenever the user clicks (mouse pressed <em>and</em> mouse released) in the list view at position <em>pos</em>. <em>button</em> +is the mouse button that the user pressed, <em>item</em> is the clicked +list view item or 0 if the user didn't click on an item. If <em>item</em> is not 0, <em>c</em> is the list view column into which the user +pressed; if <em>item</em> is 0 <em>c</em>'s value is undefined. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. + +<h3 class=fn>void <a name="mouseButtonPressed"></a>QListView::mouseButtonPressed ( int button, <a href="qlistviewitem.html">QListViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos, int c )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted whenever the user pressed the mouse button +in the list view at position <em>pos</em>. <em>button</em> is the mouse button +which the user pressed, <em>item</em> is the pressed list view item or 0 +if the user didn't press on an item. If <em>item</em> is not 0, <em>c</em> is +the list view column into which the user pressed; if <em>item</em> is 0 +<em>c</em>'s value is undefined. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. + +<h3 class=fn>void <a name="onItem"></a>QListView::onItem ( <a href="qlistviewitem.html">QListViewItem</a> * i )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when the user moves the mouse cursor onto +item <em>i</em>, similar to the <a href="qwidget.html#enterEvent">QWidget::enterEvent</a>() function. + +<h3 class=fn>void <a name="onViewport"></a>QListView::onViewport ()<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when the user moves the mouse cursor from +an item to an empty part of the list view. + +<h3 class=fn>void <a name="paintEmptyArea"></a>QListView::paintEmptyArea ( <a href="qpainter.html">QPainter</a> * p, const <a href="qrect.html">QRect</a> & rect )<tt> [virtual protected]</tt> +</h3> +Paints <em>rect</em> so that it looks like empty background using +painter <em>p</em>. <em>rect</em> is in widget coordinates, ready to be fed to +<em>p</em>. +<p> The default function fills <em>rect</em> with the +<a href="qscrollview.html#viewport">viewport</a>()->backgroundBrush(). + +<h3 class=fn>void <a name="pressed"></a>QListView::pressed ( <a href="qlistviewitem.html">QListViewItem</a> * item )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted whenever the user presses the mouse button +in a list view. <em>item</em> is the list view item on which the user +pressed the mouse button, or 0 if the user didn't press the mouse +on an item. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. + +<h3 class=fn>void <a name="pressed-2"></a>QListView::pressed ( <a href="qlistviewitem.html">QListViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pnt, int c )<tt> [signal]</tt> +</h3> + +<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> This signal is emitted whenever the user presses the mouse button +in a list view. <em>item</em> is the list view item on which the user +pressed the mouse button, or 0 if the user didn't press the mouse +on an item. <em>pnt</em> is the position of the mouse cursor in global +coordinates, and <em>c</em> is the column where the mouse cursor was +when the user pressed the mouse button. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. + +<h3 class=fn>void <a name="removeColumn"></a>QListView::removeColumn ( int index )<tt> [virtual]</tt> +</h3> +Removes the column at position <em>index</em>. +<p> If no columns remain after the column is removed, the +list view will be cleared. +<p> <p>See also <a href="#clear">clear</a>(). + +<h3 class=fn>void <a name="removeItem"></a>QListView::removeItem ( <a href="qlistviewitem.html">QListViewItem</a> * item )<tt> [virtual]</tt> +</h3> + +<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. +<p> This function has been renamed <a href="#takeItem">takeItem</a>(). + +<h3 class=fn>void <a name="repaintItem"></a>QListView::repaintItem ( const <a href="qlistviewitem.html">QListViewItem</a> * item ) const +</h3> +Repaints <em>item</em> on the screen if <em>item</em> is currently visible. +Takes care to avoid multiple repaints. + +<h3 class=fn>void <a name="resizeEvent"></a>QListView::resizeEvent ( <a href="qresizeevent.html">QResizeEvent</a> * e )<tt> [virtual protected]</tt> +</h3> +Ensures that the header is correctly sized and positioned when the +resize event <em>e</em> occurs. + +<h3 class=fn><a href="qlistview.html#ResizeMode-enum">ResizeMode</a> <a name="resizeMode"></a>QListView::resizeMode () const +</h3><p>Returns TRUE if all, none or the only the last column should be resized; otherwise returns FALSE. +See the <a href="qlistview.html#resizeMode-prop">"resizeMode"</a> property for details. +<h3 class=fn>void <a name="returnPressed"></a>QListView::returnPressed ( <a href="qlistviewitem.html">QListViewItem</a> * )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when Enter or Return is pressed. The +argument is the <a href="#currentItem">currentItem</a>(). + +<h3 class=fn>void <a name="rightButtonClicked"></a>QListView::rightButtonClicked ( <a href="qlistviewitem.html">QListViewItem</a> *, const <a href="qpoint.html">QPoint</a> &, int )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when the right button is clicked (i.e. when +it's released). The arguments are the relevant <a href="qlistviewitem.html">QListViewItem</a> (may +be 0), the point in global coordinates and the relevant column (or +-1 if the click was outside the list). + +<h3 class=fn>void <a name="rightButtonPressed"></a>QListView::rightButtonPressed ( <a href="qlistviewitem.html">QListViewItem</a> *, const <a href="qpoint.html">QPoint</a> &, int )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when the right button is pressed. The +arguments are the relevant <a href="qlistviewitem.html">QListViewItem</a> (may be 0), the point in +global coordinates and the relevant column (or -1 if the click was +outside the list). + +<h3 class=fn>bool <a name="rootIsDecorated"></a>QListView::rootIsDecorated () const +</h3><p>Returns TRUE if the list view shows open/close signs on root items; otherwise returns FALSE. +See the <a href="qlistview.html#rootIsDecorated-prop">"rootIsDecorated"</a> property for details. +<h3 class=fn>void <a name="selectAll"></a>QListView::selectAll ( bool select )<tt> [virtual slot]</tt> +</h3> +If <em>select</em> is TRUE, all the items get selected; otherwise all +the items get unselected. This only works in the selection modes <a href="#SelectionMode-enum">Multi</a> and <a href="#SelectionMode-enum">Extended</a>. In <a href="#SelectionMode-enum">Single</a> and <a href="#SelectionMode-enum">NoSelection</a> mode the +selection of the current item is just set to <em>select</em>. + +<h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="selectedItem"></a>QListView::selectedItem () const +</h3> +Returns the selected item if the list view is in <a href="#SelectionMode-enum">Single</a> +selection mode and an item is selected. +<p> If no items are selected or the list view is not in <a href="#SelectionMode-enum">Single</a> +selection mode this function returns 0. +<p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="#multiSelection-prop">multiSelection</a>. + +<h3 class=fn>void <a name="selectionChanged"></a>QListView::selectionChanged ()<tt> [signal]</tt> +</h3> + +<p> This signal is emitted whenever the set of selected items has +changed (normally before the screen update). It is available in +<a href="#SelectionMode-enum">Single</a>, <a href="#SelectionMode-enum">Multi</a>, and <a href="#SelectionMode-enum">Extended</a> selection modes, but is most +useful in <a href="#SelectionMode-enum">Multi</a> selection mode. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. +<p> <p>See also <a href="#setSelected">setSelected</a>() and <a href="qlistviewitem.html#setSelected">QListViewItem::setSelected</a>(). + +<p>Example: <a href="listviews-example.html#x148">listviews/listviews.cpp</a>. +<h3 class=fn>void <a name="selectionChanged-2"></a>QListView::selectionChanged ( <a href="qlistviewitem.html">QListViewItem</a> * )<tt> [signal]</tt> +</h3> + +<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> This signal is emitted whenever the selected item has changed in +<a href="#SelectionMode-enum">Single</a> selection mode (normally after the screen update). The +argument is the newly selected item. If the selection is cleared +(when, for example, the user clicks in the unused area of the list +view) then this signal will not be emitted. +<p> In <a href="#SelectionMode-enum">Multi</a> selection mode, use the no argument overload of this +signal. +<p> <b>Warning:</b> Do not delete any <a href="qlistviewitem.html">QListViewItem</a> objects in slots +connected to this signal. +<p> <p>See also <a href="#setSelected">setSelected</a>(), <a href="qlistviewitem.html#setSelected">QListViewItem::setSelected</a>(), and <a href="#currentChanged">currentChanged</a>(). + +<h3 class=fn><a href="qlistview.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode"></a>QListView::selectionMode () const +</h3><p>Returns the list view's selection mode. +See the <a href="qlistview.html#selectionMode-prop">"selectionMode"</a> property for details. +<h3 class=fn>void <a name="setAllColumnsShowFocus"></a>QListView::setAllColumnsShowFocus ( bool )<tt> [virtual]</tt> +</h3><p>Sets whether items should show keyboard focus using all columns. +See the <a href="qlistview.html#allColumnsShowFocus-prop">"allColumnsShowFocus"</a> property for details. +<h3 class=fn>void <a name="setColumnAlignment"></a>QListView::setColumnAlignment ( int column, int align )<tt> [virtual]</tt> +</h3> +Sets column <em>column</em>'s alignment to <em>align</em>. The alignment is +ultimately passed to <a href="qlistviewitem.html#paintCell">QListViewItem::paintCell</a>() for each item in +the list view. For horizontally aligned text with Qt::AlignLeft or +Qt::AlignHCenter the ellipsis (...) will be to the right, for +Qt::AlignRight the ellipsis will be to the left. +<p> <p>See also <a href="qt.html#AlignmentFlags-enum">Qt::AlignmentFlags</a>. + +<p>Example: <a href="listviews-example.html#x150">listviews/listviews.cpp</a>. +<h3 class=fn>void <a name="setColumnText"></a>QListView::setColumnText ( int column, const <a href="qstring.html">QString</a> & label )<tt> [virtual]</tt> +</h3> +Sets the heading of column <em>column</em> to <em>label</em>. +<p> <p>See also <a href="#columnText">columnText</a>(). + +<h3 class=fn>void <a name="setColumnText-2"></a>QListView::setColumnText ( int column, const <a href="qiconset.html">QIconSet</a> & iconset, const <a href="qstring.html">QString</a> & label )<tt> [virtual]</tt> +</h3> +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +<p> Sets the heading of column <em>column</em> to <em>iconset</em> and <em>label</em>. +<p> <p>See also <a href="#columnText">columnText</a>(). + +<h3 class=fn>void <a name="setColumnWidth"></a>QListView::setColumnWidth ( int column, int w )<tt> [virtual]</tt> +</h3> +Sets the width of column <em>column</em> to <em>w</em> pixels. Note that if +the column has a <a href="#WidthMode-enum">WidthMode</a> other than <a href="#WidthMode-enum">Manual</a>, this width +setting may be subsequently overridden. +<p> <p>See also <a href="#columnWidth">columnWidth</a>(). + +<h3 class=fn>void <a name="setColumnWidthMode"></a>QListView::setColumnWidthMode ( int c, <a href="qlistview.html#WidthMode-enum">WidthMode</a> mode )<tt> [virtual]</tt> +</h3> +Sets column <em>c</em>'s width mode to <em>mode</em>. The default depends on +the original width argument to <a href="#addColumn">addColumn</a>(). +<p> <p>See also <a href="qlistviewitem.html#width">QListViewItem::width</a>(). + +<h3 class=fn>void <a name="setCurrentItem"></a>QListView::setCurrentItem ( <a href="qlistviewitem.html">QListViewItem</a> * i )<tt> [virtual]</tt> +</h3> +Sets item <em>i</em> to be the current item and repaints appropriately +(i.e. highlights the item). The current item is used for keyboard +navigation and focus indication; it is independent of any selected +items, although a selected item can also be the current item. +<p> This function does not set the selection anchor. Use +<a href="#setSelectionAnchor">setSelectionAnchor</a>() instead. +<p> <p>See also <a href="#currentItem">currentItem</a>() and <a href="#setSelected">setSelected</a>(). + +<p>Example: <a href="listviews-example.html#x151">listviews/listviews.cpp</a>. +<h3 class=fn>void <a name="setDefaultRenameAction"></a>QListView::setDefaultRenameAction ( <a href="qlistview.html#RenameAction-enum">RenameAction</a> a )<tt> [virtual]</tt> +</h3><p>Sets what action to perform when the editor loses focus during renaming to <em>a</em>. +See the <a href="qlistview.html#defaultRenameAction-prop">"defaultRenameAction"</a> property for details. +<h3 class=fn>void <a name="setItemMargin"></a>QListView::setItemMargin ( int )<tt> [virtual]</tt> +</h3><p>Sets the advisory item margin that list items may use. +See the <a href="qlistview.html#itemMargin-prop">"itemMargin"</a> property for details. +<h3 class=fn>void <a name="setMultiSelection"></a>QListView::setMultiSelection ( bool enable )<tt> [virtual]</tt> +</h3><p>Sets whether the list view is in multi-selection or extended-selection mode to <em>enable</em>. +See the <a href="qlistview.html#multiSelection-prop">"multiSelection"</a> property for details. +<h3 class=fn>void <a name="setOpen"></a>QListView::setOpen ( <a href="qlistviewitem.html">QListViewItem</a> * item, bool open )<tt> [virtual]</tt> +</h3> +Sets <em>item</em> to be open if <em>open</em> is TRUE and <em>item</em> is +expandable, and to be closed if <em>open</em> is FALSE. Repaints +accordingly. +<p> <p>See also <a href="qlistviewitem.html#setOpen">QListViewItem::setOpen</a>() and <a href="qlistviewitem.html#setExpandable">QListViewItem::setExpandable</a>(). + +<h3 class=fn>void <a name="setResizeMode"></a>QListView::setResizeMode ( <a href="qlistview.html#ResizeMode-enum">ResizeMode</a> m )<tt> [virtual]</tt> +</h3><p>Sets whether all, none or the only the last column should be resized to <em>m</em>. +See the <a href="qlistview.html#resizeMode-prop">"resizeMode"</a> property for details. +<h3 class=fn>void <a name="setRootIsDecorated"></a>QListView::setRootIsDecorated ( bool )<tt> [virtual]</tt> +</h3><p>Sets whether the list view shows open/close signs on root items. +See the <a href="qlistview.html#rootIsDecorated-prop">"rootIsDecorated"</a> property for details. +<h3 class=fn>void <a name="setSelected"></a>QListView::setSelected ( <a href="qlistviewitem.html">QListViewItem</a> * item, bool selected )<tt> [virtual]</tt> +</h3> +If <em>selected</em> is TRUE the <em>item</em> is selected; otherwise it is +unselected. +<p> If the list view is in <a href="#SelectionMode-enum">Single</a> selection mode and <em>selected</em> is +TRUE, the currently selected item is unselected and <em>item</em> is +made current. Unlike <a href="qlistviewitem.html#setSelected">QListViewItem::setSelected</a>(), this function +updates the list view as necessary and emits the +<a href="#selectionChanged">selectionChanged</a>() signals. +<p> <p>See also <a href="#isSelected">isSelected</a>(), <a href="#multiSelection-prop">multiSelection</a>, <a href="#multiSelection-prop">multiSelection</a>, <a href="#setCurrentItem">setCurrentItem</a>(), and <a href="#setSelectionAnchor">setSelectionAnchor</a>(). + +<p>Example: <a href="listviews-example.html#x153">listviews/listviews.cpp</a>. +<h3 class=fn>void <a name="setSelectionAnchor"></a>QListView::setSelectionAnchor ( <a href="qlistviewitem.html">QListViewItem</a> * item ) +</h3> +Sets the selection anchor to <em>item</em>, if <em>item</em> is selectable. +<p> The selection anchor is the item that remains selected when +Shift-selecting with either mouse or keyboard in <a href="#SelectionMode-enum">Extended</a> +selection mode. +<p> <p>See also <a href="#setSelected">setSelected</a>(). + +<h3 class=fn>void <a name="setSelectionMode"></a>QListView::setSelectionMode ( <a href="qlistview.html#SelectionMode-enum">SelectionMode</a> mode ) +</h3><p>Sets the list view's selection mode to <em>mode</em>. +See the <a href="qlistview.html#selectionMode-prop">"selectionMode"</a> property for details. +<h3 class=fn>void <a name="setShowSortIndicator"></a>QListView::setShowSortIndicator ( bool show )<tt> [virtual]</tt> +</h3><p>Sets whether the list view header should display a sort indicator to <em>show</em>. +See the <a href="qlistview.html#showSortIndicator-prop">"showSortIndicator"</a> property for details. +<h3 class=fn>void <a name="setShowToolTips"></a>QListView::setShowToolTips ( bool b )<tt> [virtual]</tt> +</h3><p>Sets whether this list view should show tooltips for truncated column texts to <em>b</em>. +See the <a href="qlistview.html#showToolTips-prop">"showToolTips"</a> property for details. +<h3 class=fn>void <a name="setSortColumn"></a>QListView::setSortColumn ( int column ) +</h3> +Sets the sorting column for the list view. +<p> If <em>column</em> is -1, sorting is disabled and the user cannot sort +columns by clicking on the column headers. If <em>column</em> is larger +than the number of columns the user must click on a column header +to sort the list view. +<p> <p>See also <a href="#setSorting">setSorting</a>(). + +<h3 class=fn>void <a name="setSortOrder"></a>QListView::setSortOrder ( <a href="qt.html#SortOrder-enum">SortOrder</a> order ) +</h3> +Sets the sort order for the items in the list view to <em>order</em>. +<p> <p>See also <a href="#setSorting">setSorting</a>(). + +<h3 class=fn>void <a name="setSorting"></a>QListView::setSorting ( int column, bool ascending = TRUE )<tt> [virtual]</tt> +</h3> +Sets the list view to be sorted by column <em>column</em> in ascending +order if <em>ascending</em> is TRUE or descending order if it is FALSE. +<p> If <em>column</em> is -1, sorting is disabled and the user cannot sort +columns by clicking on the column headers. If <em>column</em> is larger +than the number of columns the user must click on a column +header to sort the list view. + +<h3 class=fn>void <a name="setTreeStepSize"></a>QListView::setTreeStepSize ( int )<tt> [virtual]</tt> +</h3><p>Sets the number of pixels a child is offset from its parent. +See the <a href="qlistview.html#treeStepSize-prop">"treeStepSize"</a> property for details. +<h3 class=fn>bool <a name="showSortIndicator"></a>QListView::showSortIndicator () const +</h3><p>Returns TRUE if the list view header should display a sort indicator; otherwise returns FALSE. +See the <a href="qlistview.html#showSortIndicator-prop">"showSortIndicator"</a> property for details. +<h3 class=fn>bool <a name="showToolTips"></a>QListView::showToolTips () const +</h3><p>Returns TRUE if this list view should show tooltips for truncated column texts; otherwise returns FALSE. +See the <a href="qlistview.html#showToolTips-prop">"showToolTips"</a> property for details. +<h3 class=fn>void <a name="sort"></a>QListView::sort ()<tt> [virtual]</tt> +</h3> +Sorts the list view using the last sorting configuration (sort +column and ascending/descending). + +<h3 class=fn>int <a name="sortColumn"></a>QListView::sortColumn () const +</h3> +Returns the column by which the list view is sorted, or -1 if +sorting is disabled. +<p> <p>See also <a href="#sortOrder">sortOrder</a>(). + +<h3 class=fn><a href="qt.html#SortOrder-enum">SortOrder</a> <a name="sortOrder"></a>QListView::sortOrder () const +</h3> +Returns the sorting order of the list view items. +<p> <p>See also <a href="#sortColumn">sortColumn</a>(). + +<h3 class=fn>void <a name="spacePressed"></a>QListView::spacePressed ( <a href="qlistviewitem.html">QListViewItem</a> * )<tt> [signal]</tt> +</h3> + +<p> This signal is emitted when Space is pressed. The argument is +the <a href="#currentItem">currentItem</a>(). + +<h3 class=fn>void <a name="startDrag"></a>QListView::startDrag ()<tt> [virtual protected]</tt> +</h3> +Starts a drag. + +<h3 class=fn>void <a name="takeItem"></a>QListView::takeItem ( <a href="qlistviewitem.html">QListViewItem</a> * i )<tt> [virtual]</tt> +</h3> +Removes item <em>i</em> from the list view; <em>i</em> must be a top-level +item. The warnings regarding <a href="qlistviewitem.html#takeItem">QListViewItem::takeItem</a>() apply to +this function, too. +<p> <p>See also <a href="#insertItem">insertItem</a>(). + +<h3 class=fn>int <a name="treeStepSize"></a>QListView::treeStepSize () const +</h3><p>Returns the number of pixels a child is offset from its parent. +See the <a href="qlistview.html#treeStepSize-prop">"treeStepSize"</a> property for details. +<h3 class=fn>void <a name="triggerUpdate"></a>QListView::triggerUpdate ()<tt> [slot]</tt> +</h3> +Triggers a size, geometry and content update during the next +iteration of the event loop. Ensures that there'll be just one +update to avoid flicker. + +<h3 class=fn>void <a name="updateContents"></a>QListView::updateContents ()<tt> [protected slot]</tt> +</h3> +Updates the sizes of the viewport, header, scroll bars and so on. +<p> <b>Warning:</b> Don't call this directly; call <a href="#triggerUpdate">triggerUpdate</a>() instead. + +<hr><h2>Property Documentation</h2> +<h3 class=fn>bool <a name="allColumnsShowFocus-prop"></a>allColumnsShowFocus</h3> +<p>This property holds whether items should show <a href="focus.html#keyboard-focus">keyboard focus</a> using all columns. +<p>If this property is TRUE all columns will show focus and selection +states, otherwise only column 0 will show focus. +<p> The default is FALSE. +<p> Setting this to TRUE if it's not necessary may cause noticeable +flicker. + +<p>Set this property's value with <a href="#setAllColumnsShowFocus">setAllColumnsShowFocus</a>() and get this property's value with <a href="#allColumnsShowFocus">allColumnsShowFocus</a>(). +<h3 class=fn>int <a name="childCount-prop"></a>childCount</h3> +<p>This property holds the number of parentless (top-level) <a href="qlistviewitem.html">QListViewItem</a> objects in this QListView. +<p>Holds the current number of parentless (top-level) QListViewItem +objects in this QListView. +<p> <p>See also <a href="qlistviewitem.html#childCount">QListViewItem::childCount</a>(). + +<p>Get this property's value with <a href="#childCount">childCount</a>(). +<h3 class=fn>int <a name="columns-prop"></a>columns</h3> +<p>This property holds the number of columns in this list view. +<p>Get this property's value with <a href="#columns">columns</a>(). +<p><p>See also <a href="#addColumn">addColumn</a>() and <a href="#removeColumn">removeColumn</a>(). + +<h3 class=fn><a href="qlistview.html#RenameAction-enum">RenameAction</a> <a name="defaultRenameAction-prop"></a>defaultRenameAction</h3> +<p>This property holds what action to perform when the editor loses focus during renaming. +<p>If this property is <a href="#RenameAction-enum">Accept</a>, and the user renames an item and +the editor loses focus (without the user pressing Enter), the +item will still be renamed. If the property's value is <a href="#RenameAction-enum">Reject</a>, +the item will not be renamed unless the user presses Enter. The +default is <a href="#RenameAction-enum">Reject</a>. + +<p>Set this property's value with <a href="#setDefaultRenameAction">setDefaultRenameAction</a>() and get this property's value with <a href="#defaultRenameAction">defaultRenameAction</a>(). +<h3 class=fn>int <a name="itemMargin-prop"></a>itemMargin</h3> +<p>This property holds the advisory item margin that list items may use. +<p>The item margin defaults to one pixel and is the margin between +the item's edges and the area where it draws its contents. +<a href="qlistviewitem.html#paintFocus">QListViewItem::paintFocus</a>() draws in the margin. +<p> <p>See also <a href="qlistviewitem.html#paintCell">QListViewItem::paintCell</a>(). + +<p>Set this property's value with <a href="#setItemMargin">setItemMargin</a>() and get this property's value with <a href="#itemMargin">itemMargin</a>(). +<h3 class=fn>bool <a name="multiSelection-prop"></a>multiSelection</h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. +<p> <p>This property holds whether the list view is in multi-selection or extended-selection mode. +<p>If you enable multi-selection, <a href="#SelectionMode-enum">Multi</a>, mode, it is possible to +specify whether or not this mode should be extended. <a href="#SelectionMode-enum">Extended</a> +means that the user can select multiple items only when pressing +the Shift or Ctrl key at the same time. +<p> The default selection mode is <a href="#SelectionMode-enum">Single</a>. +<p> <p>See also <a href="#selectionMode-prop">selectionMode</a>. + +<p>Set this property's value with <a href="#setMultiSelection">setMultiSelection</a>() and get this property's value with <a href="#isMultiSelection">isMultiSelection</a>(). +<h3 class=fn><a href="qlistview.html#ResizeMode-enum">ResizeMode</a> <a name="resizeMode-prop"></a>resizeMode</h3> +<p>This property holds whether all, none or the only the last column should be resized. +<p>Specifies whether all, none or only the last column should be +resized to fit the full width of the list view. The values for this +property can be one of: <a href="#ResizeMode-enum">NoColumn</a> (the default), <a href="#ResizeMode-enum">AllColumns</a> +or <a href="#ResizeMode-enum">LastColumn</a>. +<p> <b>Warning:</b> Setting the resize mode should be done after all necessary +columns have been added to the list view, otherwise the behavior is +undefined. +<p> <p>See also <a href="qheader.html">QHeader</a> and <a href="#header">header</a>(). + +<p>Set this property's value with <a href="#setResizeMode">setResizeMode</a>() and get this property's value with <a href="#resizeMode">resizeMode</a>(). +<h3 class=fn>bool <a name="rootIsDecorated-prop"></a>rootIsDecorated</h3> +<p>This property holds whether the list view shows open/close signs on root items. +<p>Open/close signs are small <b>+</b> or <b>-</b> symbols in windows +style, or arrows in <a href="motif-extension.html#Motif">Motif</a> style. The default is FALSE. + +<p>Set this property's value with <a href="#setRootIsDecorated">setRootIsDecorated</a>() and get this property's value with <a href="#rootIsDecorated">rootIsDecorated</a>(). +<h3 class=fn><a href="qlistview.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode-prop"></a>selectionMode</h3> +<p>This property holds the list view's selection mode. +<p>The mode can be <a href="#SelectionMode-enum">Single</a> (the default), <a href="#SelectionMode-enum">Extended</a>, <a href="#SelectionMode-enum">Multi</a> or +<a href="#SelectionMode-enum">NoSelection</a>. +<p> <p>See also <a href="#multiSelection-prop">multiSelection</a>. + +<p>Set this property's value with <a href="#setSelectionMode">setSelectionMode</a>() and get this property's value with <a href="#selectionMode">selectionMode</a>(). +<h3 class=fn>bool <a name="showSortIndicator-prop"></a>showSortIndicator</h3> +<p>This property holds whether the list view header should display a sort indicator. +<p>If this property is TRUE, an arrow is drawn in the header of the +list view to indicate the sort order of the list view contents. +The arrow will be drawn in the correct column and will point up or +down, depending on the current sort direction. The default is +FALSE (don't show an indicator). +<p> <p>See also <a href="qheader.html#setSortIndicator">QHeader::setSortIndicator</a>(). + +<p>Set this property's value with <a href="#setShowSortIndicator">setShowSortIndicator</a>() and get this property's value with <a href="#showSortIndicator">showSortIndicator</a>(). +<h3 class=fn>bool <a name="showToolTips-prop"></a>showToolTips</h3> +<p>This property holds whether this list view should show tooltips for truncated column texts. +<p>The default is TRUE. + +<p>Set this property's value with <a href="#setShowToolTips">setShowToolTips</a>() and get this property's value with <a href="#showToolTips">showToolTips</a>(). +<h3 class=fn>int <a name="treeStepSize-prop"></a>treeStepSize</h3> +<p>This property holds the number of pixels a child is offset from its parent. +<p>The default is 20 pixels. +<p> Of course, this property is only meaningful for hierarchical list +views. + +<p>Set this property's value with <a href="#setTreeStepSize">setTreeStepSize</a>() and get this property's value with <a href="#treeStepSize">treeStepSize</a>(). +<!-- eof --> +<hr><p> +This file is part of the <a href="index.html">Qt toolkit</a>. +Copyright © 1995-2007 +<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> +<table width=100% cellspacing=0 border=0><tr> +<td>Copyright © 2007 +<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> +<td align=right><div align=right>Qt 3.3.8</div> +</table></div></address></body> +</html> |