You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
810 lines
52 KiB
810 lines
52 KiB
<!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:370 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>TQListViewItem 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>TQListViewItem Class Reference</h1>
|
|
|
|
<p>The TQListViewItem class implements a list view item.
|
|
<a href="#details">More...</a>
|
|
<p><tt>#include <<a href="qlistview-h.html">ntqlistview.h</a>></tt>
|
|
<p>Inherits <a href="ntqt.html">TQt</a>.
|
|
<p>Inherited by <a href="qchecklistitem.html">TQCheckListItem</a>.
|
|
<p><a href="qlistviewitem-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQListViewItem"><b>TQListViewItem</b></a> ( TQListView * parent )</li>
|
|
<li class=fn><a href="#TQListViewItem-2"><b>TQListViewItem</b></a> ( TQListViewItem * parent )</li>
|
|
<li class=fn><a href="#TQListViewItem-3"><b>TQListViewItem</b></a> ( TQListView * parent, TQListViewItem * after )</li>
|
|
<li class=fn><a href="#TQListViewItem-4"><b>TQListViewItem</b></a> ( TQListViewItem * parent, TQListViewItem * after )</li>
|
|
<li class=fn><a href="#TQListViewItem-5"><b>TQListViewItem</b></a> ( TQListView * parent, TQString label1, TQString label2 = TQString::null, TQString label3 = TQString::null, TQString label4 = TQString::null, TQString label5 = TQString::null, TQString label6 = TQString::null, TQString label7 = TQString::null, TQString label8 = TQString::null )</li>
|
|
<li class=fn><a href="#TQListViewItem-6"><b>TQListViewItem</b></a> ( TQListViewItem * parent, TQString label1, TQString label2 = TQString::null, TQString label3 = TQString::null, TQString label4 = TQString::null, TQString label5 = TQString::null, TQString label6 = TQString::null, TQString label7 = TQString::null, TQString label8 = TQString::null )</li>
|
|
<li class=fn><a href="#TQListViewItem-7"><b>TQListViewItem</b></a> ( TQListView * parent, TQListViewItem * after, TQString label1, TQString label2 = TQString::null, TQString label3 = TQString::null, TQString label4 = TQString::null, TQString label5 = TQString::null, TQString label6 = TQString::null, TQString label7 = TQString::null, TQString label8 = TQString::null )</li>
|
|
<li class=fn><a href="#TQListViewItem-8"><b>TQListViewItem</b></a> ( TQListViewItem * parent, TQListViewItem * after, TQString label1, TQString label2 = TQString::null, TQString label3 = TQString::null, TQString label4 = TQString::null, TQString label5 = TQString::null, TQString label6 = TQString::null, TQString label7 = TQString::null, TQString label8 = TQString::null )</li>
|
|
<li class=fn>virtual <a href="#~TQListViewItem"><b>~TQListViewItem</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#insertItem"><b>insertItem</b></a> ( TQListViewItem * newChild )</li>
|
|
<li class=fn>virtual void <a href="#takeItem"><b>takeItem</b></a> ( TQListViewItem * item )</li>
|
|
<li class=fn>virtual void removeItem ( TQListViewItem * item ) <em>(obsolete)</em></li>
|
|
<li class=fn>int <a href="#height"><b>height</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#invalidateHeight"><b>invalidateHeight</b></a> ()</li>
|
|
<li class=fn>int <a href="#totalHeight"><b>totalHeight</b></a> () const</li>
|
|
<li class=fn>virtual int <a href="#width"><b>width</b></a> ( const TQFontMetrics & fm, const TQListView * lv, int c ) const</li>
|
|
<li class=fn>void <a href="#widthChanged"><b>widthChanged</b></a> ( int c = -1 ) const</li>
|
|
<li class=fn>int <a href="#depth"><b>depth</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( int column, const TQString & text )</li>
|
|
<li class=fn>virtual TQString <a href="#text"><b>text</b></a> ( int column ) const</li>
|
|
<li class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( int column, const TQPixmap & pm )</li>
|
|
<li class=fn>virtual const TQPixmap * <a href="#pixmap"><b>pixmap</b></a> ( int column ) const</li>
|
|
<li class=fn>virtual TQString <a href="#key"><b>key</b></a> ( int column, bool ascending ) const</li>
|
|
<li class=fn>virtual int <a href="#compare"><b>compare</b></a> ( TQListViewItem * i, int col, bool ascending ) const</li>
|
|
<li class=fn>virtual void <a href="#sortChildItems"><b>sortChildItems</b></a> ( int column, bool ascending )</li>
|
|
<li class=fn>int <a href="#childCount"><b>childCount</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isOpen"><b>isOpen</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setOpen"><b>setOpen</b></a> ( bool o )</li>
|
|
<li class=fn>virtual void <a href="#setup"><b>setup</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( bool s )</li>
|
|
<li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#paintCell"><b>paintCell</b></a> ( TQPainter * p, const TQColorGroup & cg, int column, int width, int align )</li>
|
|
<li class=fn>virtual void <a href="#paintBranches"><b>paintBranches</b></a> ( TQPainter * p, const TQColorGroup & cg, int w, int y, int h )</li>
|
|
<li class=fn>virtual void <a href="#paintFocus"><b>paintFocus</b></a> ( TQPainter * p, const TQColorGroup & cg, const TQRect & r )</li>
|
|
<li class=fn>TQListViewItem * <a href="#firstChild"><b>firstChild</b></a> () const</li>
|
|
<li class=fn>TQListViewItem * <a href="#nextSibling"><b>nextSibling</b></a> () const</li>
|
|
<li class=fn>TQListViewItem * <a href="#parent"><b>parent</b></a> () const</li>
|
|
<li class=fn>TQListViewItem * <a href="#itemAbove"><b>itemAbove</b></a> ()</li>
|
|
<li class=fn>TQListViewItem * <a href="#itemBelow"><b>itemBelow</b></a> ()</li>
|
|
<li class=fn>int <a href="#itemPos"><b>itemPos</b></a> () const</li>
|
|
<li class=fn>TQListView * <a href="#listView"><b>listView</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setSelectable"><b>setSelectable</b></a> ( bool enable )</li>
|
|
<li class=fn>bool <a href="#isSelectable"><b>isSelectable</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setExpandable"><b>setExpandable</b></a> ( bool enable )</li>
|
|
<li class=fn>bool <a href="#isExpandable"><b>isExpandable</b></a> () const</li>
|
|
<li class=fn>void <a href="#repaint"><b>repaint</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#sort"><b>sort</b></a> ()</li>
|
|
<li class=fn>void <a href="#moveItem"><b>moveItem</b></a> ( TQListViewItem * after )</li>
|
|
<li class=fn>virtual void <a href="#setDragEnabled"><b>setDragEnabled</b></a> ( bool allow )</li>
|
|
<li class=fn>virtual void <a href="#setDropEnabled"><b>setDropEnabled</b></a> ( bool allow )</li>
|
|
<li class=fn>bool <a href="#dragEnabled"><b>dragEnabled</b></a> () const</li>
|
|
<li class=fn>bool <a href="#dropEnabled"><b>dropEnabled</b></a> () const</li>
|
|
<li class=fn>virtual bool <a href="#acceptDrop"><b>acceptDrop</b></a> ( const TQMimeSource * mime ) const</li>
|
|
<li class=fn>void <a href="#setVisible"><b>setVisible</b></a> ( bool b )</li>
|
|
<li class=fn>bool <a href="#isVisible"><b>isVisible</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setRenameEnabled"><b>setRenameEnabled</b></a> ( int col, bool b )</li>
|
|
<li class=fn>bool <a href="#renameEnabled"><b>renameEnabled</b></a> ( int col ) const</li>
|
|
<li class=fn>virtual void <a href="#startRename"><b>startRename</b></a> ( int col )</li>
|
|
<li class=fn>virtual void <a href="#setEnabled"><b>setEnabled</b></a> ( bool b )</li>
|
|
<li class=fn>bool <a href="#isEnabled"><b>isEnabled</b></a> () const</li>
|
|
<li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setMultiLinesEnabled"><b>setMultiLinesEnabled</b></a> ( bool b )</li>
|
|
<li class=fn>bool <a href="#multiLinesEnabled"><b>multiLinesEnabled</b></a> () const</li>
|
|
</ul>
|
|
<h2>Protected Members</h2>
|
|
<ul>
|
|
<li class=fn>virtual void <a href="#enforceSortOrder"><b>enforceSortOrder</b></a> () const</li>
|
|
<li class=fn>virtual void <a href="#setHeight"><b>setHeight</b></a> ( int height )</li>
|
|
<li class=fn>virtual void <a href="#activate"><b>activate</b></a> ()</li>
|
|
<li class=fn>bool <a href="#activatedPos"><b>activatedPos</b></a> ( TQPoint & pos )</li>
|
|
<li class=fn>virtual void <a href="#dropped"><b>dropped</b></a> ( TQDropEvent * e )</li>
|
|
<li class=fn>virtual void <a href="#dragEntered"><b>dragEntered</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#dragLeft"><b>dragLeft</b></a> ()</li>
|
|
<li class=fn>virtual void <a href="#okRename"><b>okRename</b></a> ( int col )</li>
|
|
<li class=fn>virtual void <a href="#cancelRename"><b>cancelRename</b></a> ( int col )</li>
|
|
</ul>
|
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
|
|
|
|
|
The TQListViewItem class implements a list view item.
|
|
<p>
|
|
<p> A list view item is a multi-column object capable of displaying
|
|
itself in a <a href="ntqlistview.html">TQListView</a>.
|
|
<p> The easiest way to use TQListViewItem is to construct one with a
|
|
few constant strings, and either a TQListView or another
|
|
TQListViewItem as parent.
|
|
<pre>
|
|
(void) new TQListViewItem( listView, "Column 1", "Column 2" );
|
|
(void) new TQListViewItem( listView->firstChild(), "A", "B", "C" );
|
|
</pre>
|
|
|
|
We've discarded the pointers to the items since we can still access
|
|
them via their parent <em>listView</em>. By default, TQListView sorts its
|
|
items; this can be switched off with <a href="ntqlistview.html#setSorting">TQListView::setSorting</a>(-1).
|
|
<p> The parent must be another TQListViewItem or a TQListView. If the
|
|
parent is a TQListView, the item becomes a top-level item within
|
|
that TQListView. If the parent is another TQListViewItem, the item
|
|
becomes a child of that list view item.
|
|
<p> If you keep the pointer, you can set or change the texts using
|
|
<a href="#setText">setText</a>(), add pixmaps using <a href="#setPixmap">setPixmap</a>(), change its mode using
|
|
<a href="#setSelectable">setSelectable</a>(), <a href="#setSelected">setSelected</a>(), <a href="#setOpen">setOpen</a>() and <a href="#setExpandable">setExpandable</a>().
|
|
You'll also be able to change its height using <a href="#setHeight">setHeight</a>(), and
|
|
traverse its sub-items. You don't have to keep the pointer since
|
|
you can get a pointer to any TQListViewItem in a <a href="ntqlistview.html">TQListView</a> using
|
|
<a href="ntqlistview.html#selectedItem">TQListView::selectedItem</a>(), <a href="ntqlistview.html#currentItem">TQListView::currentItem</a>(),
|
|
<a href="ntqlistview.html#firstChild">TQListView::firstChild</a>(), <a href="ntqlistview.html#lastItem">TQListView::lastItem</a>() and
|
|
<a href="ntqlistview.html#findItem">TQListView::findItem</a>().
|
|
<p> If you call <tt>delete</tt> on a list view item, it will be deleted as
|
|
expected, and as usual for <a href="ntqobject.html">TQObject</a>s, if it has any child items
|
|
(to any depth), all these will be deleted too.
|
|
<p> <a href="qchecklistitem.html">TQCheckListItem</a>s are list view items that have a checkbox or
|
|
radio button and can be used in place of plain TQListViewItems.
|
|
<p> You can traverse the tree as if it were a doubly-linked list using
|
|
<a href="#itemAbove">itemAbove</a>() and <a href="#itemBelow">itemBelow</a>(); they return pointers to the items
|
|
directly above and below this item on the screen (even if none of
|
|
them are actually visible at the moment).
|
|
<p> Here's how to traverse all of an item's children (but not its
|
|
children's children, etc.):
|
|
Example:
|
|
<pre>
|
|
TQListViewItem * myChild = myItem->firstChild();
|
|
while( myChild ) {
|
|
doSomething( myChild );
|
|
myChild = myChild-><a href="#nextSibling">nextSibling</a>();
|
|
}
|
|
</pre>
|
|
|
|
<p> If you want to iterate over every item, to any level of depth use
|
|
an iterator. To iterate over the entire tree, initialize the
|
|
iterator with the list view itself; to iterate starting from a
|
|
particular item, initialize the iterator with the item:
|
|
<p> <pre>
|
|
<a href="qlistviewitemiterator.html">TQListViewItemIterator</a> it( listview );
|
|
while ( it.<a href="qlistviewitemiterator.html#current">current</a>() ) {
|
|
TQListViewItem *item = it.<a href="qlistviewitemiterator.html#current">current</a>();
|
|
doSomething( item );
|
|
++it;
|
|
}
|
|
</pre>
|
|
|
|
<p> Note that the order of the children will change when the sorting
|
|
order changes and is undefined if the items are not visible. You
|
|
can, however, call <a href="#enforceSortOrder">enforceSortOrder</a>() at any time; <a href="ntqlistview.html">TQListView</a> will
|
|
always call it before it needs to show an item.
|
|
<p> Many programs will need to reimplement TQListViewItem. The most
|
|
commonly reimplemented functions are:
|
|
<center><table cellpadding="4" cellspacing="2" border="0">
|
|
<tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Description
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#text">text</a>()
|
|
<td valign="top">Returns the text in a column. Many subclasses will compute
|
|
this on the fly.
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#key">key</a>()
|
|
<td valign="top">Used for sorting. The default <a href="#key">key</a>() simply calls
|
|
<a href="#text">text</a>(), but judicious use of key() can give you fine
|
|
control over sorting; for example, <a href="ntqfiledialog.html">TQFileDialog</a>
|
|
reimplements key() to sort by date.
|
|
<tr bgcolor="#f0f0f0"> <td valign="top"><a href="#setup">setup</a>()
|
|
<td valign="top">Called before showing the item and whenever the list
|
|
view's font changes, for example.
|
|
<tr bgcolor="#d0d0d0"> <td valign="top"><a href="#activate">activate</a>()
|
|
<td valign="top">Called whenever the user clicks on the item or presses
|
|
Space when the item is the current item.
|
|
</table></center>
|
|
<p> Some subclasses call <a href="#setExpandable">setExpandable</a>(TRUE) even when they have no
|
|
children, and populate themselves when <a href="#setup">setup</a>() or <a href="#setOpen">setOpen</a>(TRUE) is
|
|
called. The <a href="dirview-example.html">dirview/dirview.cpp</a> example program uses this
|
|
technique to start up tquickly: The files and subdirectories in a
|
|
directory aren't inserted into the tree until they're actually
|
|
needed.
|
|
<p> <center><img src="qlistviewitems.png" alt="List View Items"></center>
|
|
<p> <p>See also <a href="qchecklistitem.html">TQCheckListItem</a>, <a href="ntqlistview.html">TQListView</a>, and <a href="advanced.html">Advanced Widgets</a>.
|
|
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<h3 class=fn><a name="TQListViewItem"></a>TQListViewItem::TQListViewItem ( <a href="ntqlistview.html">TQListView</a> * parent )
|
|
</h3>
|
|
Constructs a new top-level list view item in the <a href="ntqlistview.html">TQListView</a> <em>parent</em>.
|
|
|
|
<h3 class=fn><a name="TQListViewItem-2"></a>TQListViewItem::TQListViewItem ( <a href="qlistviewitem.html">TQListViewItem</a> * parent )
|
|
</h3>
|
|
Constructs a new list view item that is a child of <em>parent</em> and
|
|
first in the parent's list of children.
|
|
|
|
<h3 class=fn><a name="TQListViewItem-3"></a>TQListViewItem::TQListViewItem ( <a href="ntqlistview.html">TQListView</a> * parent, <a href="qlistviewitem.html">TQListViewItem</a> * after )
|
|
</h3>
|
|
Constructs an empty list view item that is a child of <em>parent</em>
|
|
and is after item <em>after</em> in the parent's list of children. Since
|
|
<em>parent</em> is a <a href="ntqlistview.html">TQListView</a> the item will be a top-level item.
|
|
|
|
<h3 class=fn><a name="TQListViewItem-4"></a>TQListViewItem::TQListViewItem ( <a href="qlistviewitem.html">TQListViewItem</a> * parent, <a href="qlistviewitem.html">TQListViewItem</a> * after )
|
|
</h3>
|
|
Constructs an empty list view item that is a child of <em>parent</em>
|
|
and is after item <em>after</em> in the parent's list of children.
|
|
|
|
<h3 class=fn><a name="TQListViewItem-5"></a>TQListViewItem::TQListViewItem ( <a href="ntqlistview.html">TQListView</a> * parent, <a href="ntqstring.html">TQString</a> label1, <a href="ntqstring.html">TQString</a> label2 = TQString::null, <a href="ntqstring.html">TQString</a> label3 = TQString::null, <a href="ntqstring.html">TQString</a> label4 = TQString::null, <a href="ntqstring.html">TQString</a> label5 = TQString::null, <a href="ntqstring.html">TQString</a> label6 = TQString::null, <a href="ntqstring.html">TQString</a> label7 = TQString::null, <a href="ntqstring.html">TQString</a> label8 = TQString::null )
|
|
</h3>
|
|
Constructs a new top-level list view item in the <a href="ntqlistview.html">TQListView</a> <em>parent</em>, with up to eight constant strings, <em>label1</em>, <em>label2</em>, <em>label3</em>, <em>label4</em>, <em>label5</em>, <em>label6</em>, <em>label7</em> and <em>label8</em>
|
|
defining its columns' contents.
|
|
<p> <p>See also <a href="#setText">setText</a>().
|
|
|
|
<h3 class=fn><a name="TQListViewItem-6"></a>TQListViewItem::TQListViewItem ( <a href="qlistviewitem.html">TQListViewItem</a> * parent, <a href="ntqstring.html">TQString</a> label1, <a href="ntqstring.html">TQString</a> label2 = TQString::null, <a href="ntqstring.html">TQString</a> label3 = TQString::null, <a href="ntqstring.html">TQString</a> label4 = TQString::null, <a href="ntqstring.html">TQString</a> label5 = TQString::null, <a href="ntqstring.html">TQString</a> label6 = TQString::null, <a href="ntqstring.html">TQString</a> label7 = TQString::null, <a href="ntqstring.html">TQString</a> label8 = TQString::null )
|
|
</h3>
|
|
Constructs a new list view item as a child of the TQListViewItem <em>parent</em> with up to eight constant strings, <em>label1</em>, <em>label2</em>, <em>label3</em>, <em>label4</em>, <em>label5</em>, <em>label6</em>, <em>label7</em> and <em>label8</em>
|
|
as columns' contents.
|
|
<p> <p>See also <a href="#setText">setText</a>().
|
|
|
|
<h3 class=fn><a name="TQListViewItem-7"></a>TQListViewItem::TQListViewItem ( <a href="ntqlistview.html">TQListView</a> * parent, <a href="qlistviewitem.html">TQListViewItem</a> * after, <a href="ntqstring.html">TQString</a> label1, <a href="ntqstring.html">TQString</a> label2 = TQString::null, <a href="ntqstring.html">TQString</a> label3 = TQString::null, <a href="ntqstring.html">TQString</a> label4 = TQString::null, <a href="ntqstring.html">TQString</a> label5 = TQString::null, <a href="ntqstring.html">TQString</a> label6 = TQString::null, <a href="ntqstring.html">TQString</a> label7 = TQString::null, <a href="ntqstring.html">TQString</a> label8 = TQString::null )
|
|
</h3>
|
|
Constructs a new list view item in the <a href="ntqlistview.html">TQListView</a> <em>parent</em> that is
|
|
included after item <em>after</em> and that has up to eight column
|
|
texts, <em>label1</em>, <em>label2</em>, <em>label3</em>, <em>label4</em>, <em>label5</em>, <em>label6</em>, <em>label7</em> and<em>label8</em>.
|
|
<p> Note that the order is changed according to <a href="#key">TQListViewItem::key</a>()
|
|
unless the list view's sorting is disabled using
|
|
<a href="ntqlistview.html#setSorting">TQListView::setSorting</a>(-1).
|
|
<p> <p>See also <a href="#setText">setText</a>().
|
|
|
|
<h3 class=fn><a name="TQListViewItem-8"></a>TQListViewItem::TQListViewItem ( <a href="qlistviewitem.html">TQListViewItem</a> * parent, <a href="qlistviewitem.html">TQListViewItem</a> * after, <a href="ntqstring.html">TQString</a> label1, <a href="ntqstring.html">TQString</a> label2 = TQString::null, <a href="ntqstring.html">TQString</a> label3 = TQString::null, <a href="ntqstring.html">TQString</a> label4 = TQString::null, <a href="ntqstring.html">TQString</a> label5 = TQString::null, <a href="ntqstring.html">TQString</a> label6 = TQString::null, <a href="ntqstring.html">TQString</a> label7 = TQString::null, <a href="ntqstring.html">TQString</a> label8 = TQString::null )
|
|
</h3>
|
|
Constructs a new list view item as a child of the TQListViewItem <em>parent</em>. It is inserted after item <em>after</em> and may contain up to
|
|
eight strings, <em>label1</em>, <em>label2</em>, <em>label3</em>, <em>label4</em>, <em>label5</em>, <em>label6</em>, <em>label7</em> and <em>label8</em> as column entries.
|
|
<p> Note that the order is changed according to <a href="#key">TQListViewItem::key</a>()
|
|
unless the list view's sorting is disabled using
|
|
<a href="ntqlistview.html#setSorting">TQListView::setSorting</a>(-1).
|
|
<p> <p>See also <a href="#setText">setText</a>().
|
|
|
|
<h3 class=fn><a name="~TQListViewItem"></a>TQListViewItem::~TQListViewItem ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Destroys the item, deleting all its children and freeing up all
|
|
allocated resources.
|
|
|
|
<h3 class=fn>bool <a name="acceptDrop"></a>TQListViewItem::acceptDrop ( const <a href="qmimesource.html">TQMimeSource</a> * mime ) const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns TRUE if the item can accept drops of type <a href="qmimesource.html">TQMimeSource</a> <em>mime</em>; otherwise returns FALSE.
|
|
<p> The default implementation does nothing and returns FALSE. A
|
|
subclass must reimplement this to accept drops.
|
|
|
|
<h3 class=fn>void <a name="activate"></a>TQListViewItem::activate ()<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This virtual function is called whenever the user presses the mouse
|
|
on this item or presses Space on it.
|
|
<p> <p>See also <a href="#activatedPos">activatedPos</a>().
|
|
|
|
<p>Reimplemented in <a href="qchecklistitem.html#activate">TQCheckListItem</a>.
|
|
<h3 class=fn>bool <a name="activatedPos"></a>TQListViewItem::activatedPos ( <a href="ntqpoint.html">TQPoint</a> & pos )<tt> [protected]</tt>
|
|
</h3>
|
|
When called from a reimplementation of <a href="#activate">activate</a>(), this function
|
|
gives information on how the item was activated. Otherwise the
|
|
behavior is undefined.
|
|
<p> If activate() was caused by a mouse press, the function sets <em>pos</em> to where the user clicked and returns TRUE; otherwise it
|
|
returns FALSE and does not change <em>pos</em>.
|
|
<p> <em>pos</em> is relative to the top-left corner of this item.
|
|
<p> <b>Warning:</b> We recommend that you ignore this function; it is
|
|
scheduled to become obsolete.
|
|
<p> <p>See also <a href="#activate">activate</a>().
|
|
|
|
<h3 class=fn>void <a name="cancelRename"></a>TQListViewItem::cancelRename ( int col )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This function is called if the user cancels in-place renaming of
|
|
this item in column <em>col</em> (e.g. by pressing Esc).
|
|
<p> <p>See also <a href="#okRename">okRename</a>().
|
|
|
|
<h3 class=fn>int <a name="childCount"></a>TQListViewItem::childCount () const
|
|
</h3>
|
|
|
|
<p> Returns how many children this item has. The count only includes
|
|
the item's immediate children.
|
|
|
|
<h3 class=fn>int <a name="compare"></a>TQListViewItem::compare ( <a href="qlistviewitem.html">TQListViewItem</a> * i, int col, bool ascending ) const<tt> [virtual]</tt>
|
|
</h3>
|
|
Compares this list view item to <em>i</em> using the column <em>col</em> in <em>ascending</em> order. Returns < 0 if this item is less than <em>i</em>, 0 if
|
|
they are equal and > 0 if this item is greater than <em>i</em>.
|
|
<p> This function is used for sorting.
|
|
<p> The default implementation compares the item keys (<a href="#key">key</a>()) using
|
|
<a href="ntqstring.html#localeAwareCompare">TQString::localeAwareCompare</a>(). A reimplementation can use
|
|
different values and a different comparison function. Here is a
|
|
reimplementation that uses plain Unicode comparison:
|
|
<p> <pre>
|
|
int MyListViewItem::compare( TQListViewItem *i, int col,
|
|
bool ascending ) const
|
|
{
|
|
return key( col, ascending ).compare( i-><a href="#key">key</a>( col, ascending) );
|
|
}
|
|
</pre>
|
|
|
|
We don't recommend using <em>ascending</em> so your code can safely
|
|
ignore it.
|
|
<p> <p>See also <a href="#key">key</a>(), <a href="ntqstring.html#localeAwareCompare">TQString::localeAwareCompare</a>(), and <a href="ntqstring.html#compare">TQString::compare</a>().
|
|
|
|
<h3 class=fn>int <a name="depth"></a>TQListViewItem::depth () const
|
|
</h3>
|
|
Returns the depth of this item.
|
|
|
|
<p>Example: <a href="dirview-example.html#x1686">dirview/dirview.cpp</a>.
|
|
<h3 class=fn>bool <a name="dragEnabled"></a>TQListViewItem::dragEnabled () const
|
|
</h3>
|
|
Returns TRUE if this item can be dragged; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#setDragEnabled">setDragEnabled</a>().
|
|
|
|
<h3 class=fn>void <a name="dragEntered"></a>TQListViewItem::dragEntered ()<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This function is called when a drag enters the item's bounding
|
|
rectangle.
|
|
<p> The default implementation does nothing, subclasses may need to
|
|
reimplement this function.
|
|
|
|
<h3 class=fn>void <a name="dragLeft"></a>TQListViewItem::dragLeft ()<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This function is called when a drag leaves the item's bounding
|
|
rectangle.
|
|
<p> The default implementation does nothing, subclasses may need to
|
|
reimplement this function.
|
|
|
|
<h3 class=fn>bool <a name="dropEnabled"></a>TQListViewItem::dropEnabled () const
|
|
</h3>
|
|
Returns TRUE if this item accepts drops; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#setDropEnabled">setDropEnabled</a>() and <a href="#acceptDrop">acceptDrop</a>().
|
|
|
|
<h3 class=fn>void <a name="dropped"></a>TQListViewItem::dropped ( <a href="qdropevent.html">TQDropEvent</a> * e )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This function is called when something was dropped on the item. <em>e</em>
|
|
contains all the information about the drop.
|
|
<p> The default implementation does nothing, subclasses may need to
|
|
reimplement this function.
|
|
|
|
<h3 class=fn>void <a name="enforceSortOrder"></a>TQListViewItem::enforceSortOrder () const<tt> [virtual protected]</tt>
|
|
</h3>
|
|
Makes sure that this object's children are sorted appropriately.
|
|
<p> This only works if every item from the root item down to this item
|
|
is already sorted.
|
|
<p> <p>See also <a href="#sortChildItems">sortChildItems</a>().
|
|
|
|
<h3 class=fn><a href="qlistviewitem.html">TQListViewItem</a> * <a name="firstChild"></a>TQListViewItem::firstChild () const
|
|
</h3>
|
|
Returns the first (top) child of this item, or 0 if this item has
|
|
no children.
|
|
<p> Note that the children are not guaranteed to be sorted properly.
|
|
<a href="ntqlistview.html">TQListView</a> and TQListViewItem try to postpone or avoid sorting to
|
|
the greatest degree possible, in order to keep the user interface
|
|
snappy.
|
|
<p> <p>See also <a href="#nextSibling">nextSibling</a>() and <a href="#sortChildItems">sortChildItems</a>().
|
|
|
|
<p>Example: <a href="checklists-example.html#x430">checklists/checklists.cpp</a>.
|
|
<h3 class=fn>int <a name="height"></a>TQListViewItem::height () const
|
|
</h3>
|
|
Returns the height of this item in pixels. This does not include
|
|
the height of any children; <a href="#totalHeight">totalHeight</a>() returns that.
|
|
|
|
<h3 class=fn>void <a name="insertItem"></a>TQListViewItem::insertItem ( <a href="qlistviewitem.html">TQListViewItem</a> * newChild )<tt> [virtual]</tt>
|
|
</h3>
|
|
Inserts <em>newChild</em> into this list view item's list of children.
|
|
You should not need to call this function; it is called
|
|
automatically by the constructor of <em>newChild</em>.
|
|
<p> <b>Warning:</b> If you are using <tt>Single</tt> selection mode, then you
|
|
should only insert unselected items.
|
|
|
|
<h3 class=fn>void <a name="invalidateHeight"></a>TQListViewItem::invalidateHeight ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Invalidates the cached total height of this item, including all
|
|
open children.
|
|
<p> <p>See also <a href="#setHeight">setHeight</a>(), <a href="#height">height</a>(), and <a href="#totalHeight">totalHeight</a>().
|
|
|
|
<h3 class=fn>bool <a name="isEnabled"></a>TQListViewItem::isEnabled () const
|
|
</h3>
|
|
Returns TRUE if this item is enabled; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#setEnabled">setEnabled</a>().
|
|
|
|
<h3 class=fn>bool <a name="isExpandable"></a>TQListViewItem::isExpandable () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this item is expandable even when it has no
|
|
children; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="isOpen"></a>TQListViewItem::isOpen () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this list view item has children <em>and</em> they are
|
|
not explicitly hidden; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#setOpen">setOpen</a>().
|
|
|
|
<h3 class=fn>bool <a name="isSelectable"></a>TQListViewItem::isSelectable () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if the item is selectable (as it is by default);
|
|
otherwise returns FALSE
|
|
<p> <p>See also <a href="#setSelectable">setSelectable</a>().
|
|
|
|
<h3 class=fn>bool <a name="isSelected"></a>TQListViewItem::isSelected () const
|
|
</h3>
|
|
|
|
<p> Returns TRUE if this item is selected; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#setSelected">setSelected</a>(), <a href="ntqlistview.html#setSelected">TQListView::setSelected</a>(), and <a href="ntqlistview.html#selectionChanged">TQListView::selectionChanged</a>().
|
|
|
|
<p>Example: <a href="listviews-example.html#x156">listviews/listviews.cpp</a>.
|
|
<h3 class=fn>bool <a name="isVisible"></a>TQListViewItem::isVisible () const
|
|
</h3>
|
|
Returns TRUE if the item is visible; otherwise returns FALSE.
|
|
<p> <p>See also <a href="#setVisible">setVisible</a>().
|
|
|
|
<h3 class=fn><a href="qlistviewitem.html">TQListViewItem</a> * <a name="itemAbove"></a>TQListViewItem::itemAbove ()
|
|
</h3>
|
|
Returns a pointer to the item immediately above this item on the
|
|
screen. This is usually the item's closest older sibling, but it
|
|
may also be its parent or its next older sibling's youngest child,
|
|
or something else if anyoftheabove->height() returns 0. Returns 0
|
|
if there is no item immediately above this item.
|
|
<p> This function assumes that all parents of this item are open (i.e.
|
|
that this item is visible, or can be made visible by scrolling).
|
|
<p> This function might be relatively slow because of the tree
|
|
traversions needed to find the correct item.
|
|
<p> <p>See also <a href="#itemBelow">itemBelow</a>() and <a href="ntqlistview.html#itemRect">TQListView::itemRect</a>().
|
|
|
|
<h3 class=fn><a href="qlistviewitem.html">TQListViewItem</a> * <a name="itemBelow"></a>TQListViewItem::itemBelow ()
|
|
</h3>
|
|
Returns a pointer to the item immediately below this item on the
|
|
screen. This is usually the item's eldest child, but it may also
|
|
be its next younger sibling, its parent's next younger sibling,
|
|
grandparent's, etc., or something else if anyoftheabove->height()
|
|
returns 0. Returns 0 if there is no item immediately below this
|
|
item.
|
|
<p> This function assumes that all parents of this item are open (i.e.
|
|
that this item is visible or can be made visible by scrolling).
|
|
<p> <p>See also <a href="#itemAbove">itemAbove</a>() and <a href="ntqlistview.html#itemRect">TQListView::itemRect</a>().
|
|
|
|
<p>Example: <a href="dirview-example.html#x1687">dirview/dirview.cpp</a>.
|
|
<h3 class=fn>int <a name="itemPos"></a>TQListViewItem::itemPos () const
|
|
</h3>
|
|
Returns the y coordinate of this item in the list view's
|
|
coordinate system. This function is normally much slower than
|
|
<a href="ntqlistview.html#itemAt">TQListView::itemAt</a>(), but it works for all items whereas
|
|
TQListView::itemAt() normally only works for items on the screen.
|
|
<p> <p>See also <a href="ntqlistview.html#itemAt">TQListView::itemAt</a>(), <a href="ntqlistview.html#itemRect">TQListView::itemRect</a>(), and <a href="ntqlistview.html#itemPos">TQListView::itemPos</a>().
|
|
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="key"></a>TQListViewItem::key ( int column, bool ascending ) const<tt> [virtual]</tt>
|
|
</h3>
|
|
|
|
<p> Returns a key that can be used for sorting by column <em>column</em>.
|
|
The default implementation returns <a href="#text">text</a>(). Derived classes may
|
|
also incorporate the order indicated by <em>ascending</em> into this
|
|
key, although this is not recommended.
|
|
<p> If you want to sort on non-alphabetical data, e.g. dates, numbers,
|
|
etc., it is more efficient to reimplement <a href="#compare">compare</a>().
|
|
<p> <p>See also <a href="#compare">compare</a>() and <a href="#sortChildItems">sortChildItems</a>().
|
|
|
|
<h3 class=fn><a href="ntqlistview.html">TQListView</a> * <a name="listView"></a>TQListViewItem::listView () const
|
|
</h3>
|
|
Returns a pointer to the list view containing this item.
|
|
<p> Note that this function traverses the items to the root to find the
|
|
listview. This function will return 0 for taken items - see
|
|
<a href="#takeItem">TQListViewItem::takeItem</a>()
|
|
|
|
<h3 class=fn>void <a name="moveItem"></a>TQListViewItem::moveItem ( <a href="qlistviewitem.html">TQListViewItem</a> * after )
|
|
</h3>
|
|
Move the item to be after item <em>after</em>, which must be one of the
|
|
item's siblings. To move an item in the hierarchy, use <a href="#takeItem">takeItem</a>()
|
|
and <a href="#insertItem">insertItem</a>().
|
|
<p> Note that this function will have no effect if sorting is enabled
|
|
in the list view.
|
|
|
|
<h3 class=fn>bool <a name="multiLinesEnabled"></a>TQListViewItem::multiLinesEnabled () const
|
|
</h3>
|
|
Returns TRUE if the item can display multiple lines of text in its
|
|
columns; otherwise returns FALSE.
|
|
|
|
<h3 class=fn><a href="qlistviewitem.html">TQListViewItem</a> * <a name="nextSibling"></a>TQListViewItem::nextSibling () const
|
|
</h3>
|
|
|
|
<p> Returns the sibling item below this item, or 0 if there is no
|
|
sibling item after this item.
|
|
<p> Note that the siblings are not guaranteed to be sorted properly.
|
|
<a href="ntqlistview.html">TQListView</a> and TQListViewItem try to postpone or avoid sorting to
|
|
the greatest degree possible, in order to keep the user interface
|
|
snappy.
|
|
<p> <p>See also <a href="#firstChild">firstChild</a>() and <a href="#sortChildItems">sortChildItems</a>().
|
|
|
|
<p>Example: <a href="tagreader-with-features-example.html#x1965">xml/tagreader-with-features/structureparser.cpp</a>.
|
|
<h3 class=fn>void <a name="okRename"></a>TQListViewItem::okRename ( int col )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
This function is called if the user presses Enter during in-place
|
|
renaming of the item in column <em>col</em>.
|
|
<p> <p>See also <a href="#cancelRename">cancelRename</a>().
|
|
|
|
<h3 class=fn>void <a name="paintBranches"></a>TQListViewItem::paintBranches ( <a href="ntqpainter.html">TQPainter</a> * p, const <a href="qcolorgroup.html">TQColorGroup</a> & cg, int w, int y, int h )<tt> [virtual]</tt>
|
|
</h3>
|
|
Paints a set of branches from this item to (some of) its children.
|
|
<p> Painter <em>p</em> is set up with clipping and translation so that you
|
|
can only draw in the rectangle that needs redrawing; <em>cg</em> is the
|
|
color group to use; the update rectangle is at (0, 0) and has size
|
|
width <em>w</em> by height <em>h</em>. The top of the rectangle you own is at
|
|
<em>y</em> (which is never greater than 0 but can be outside the window
|
|
system's allowed coordinate range).
|
|
<p> The update rectangle is in an undefined state when this function
|
|
is called; this function must draw on <em>all</em> of the pixels.
|
|
<p> <p>See also <a href="#paintCell">paintCell</a>() and <a href="ntqlistview.html#drawContentsOffset">TQListView::drawContentsOffset</a>().
|
|
|
|
<h3 class=fn>void <a name="paintCell"></a>TQListViewItem::paintCell ( <a href="ntqpainter.html">TQPainter</a> * p, const <a href="qcolorgroup.html">TQColorGroup</a> & cg, int column, int width, int align )<tt> [virtual]</tt>
|
|
</h3>
|
|
This virtual function paints the contents of one column of an item
|
|
and aligns it as described by <em>align</em>.
|
|
<p> <em>p</em> is a <a href="ntqpainter.html">TQPainter</a> open on the relevant paint device. <em>p</em> is
|
|
translated so (0, 0) is the top-left pixel in the cell and <em>width-1</em>, <a href="#height">height</a>()-1 is the bottom-right pixel <em>in</em> the cell. The
|
|
other properties of <em>p</em> (pen, brush, etc) are undefined. <em>cg</em> is
|
|
the color group to use. <em>column</em> is the logical column number
|
|
within the item that is to be painted; 0 is the column which may
|
|
contain a tree.
|
|
<p> This function may use <a href="ntqlistview.html#itemMargin">TQListView::itemMargin</a>() for readability
|
|
spacing on the left and right sides of data such as text, and
|
|
should honor <a href="#isSelected">isSelected</a>() and <a href="ntqlistview.html#allColumnsShowFocus">TQListView::allColumnsShowFocus</a>().
|
|
<p> If you reimplement this function, you should also reimplement
|
|
<a href="#width">width</a>().
|
|
<p> The rectangle to be painted is in an undefined state when this
|
|
function is called, so you <em>must</em> draw on all the pixels. The
|
|
painter <em>p</em> has the right font on entry.
|
|
<p> <p>See also <a href="#paintBranches">paintBranches</a>() and <a href="ntqlistview.html#drawContentsOffset">TQListView::drawContentsOffset</a>().
|
|
|
|
<p>Example: <a href="listviews-example.html#x157">listviews/listviews.cpp</a>.
|
|
<p>Reimplemented in <a href="qchecklistitem.html#paintCell">TQCheckListItem</a>.
|
|
<h3 class=fn>void <a name="paintFocus"></a>TQListViewItem::paintFocus ( <a href="ntqpainter.html">TQPainter</a> * p, const <a href="qcolorgroup.html">TQColorGroup</a> & cg, const <a href="ntqrect.html">TQRect</a> & r )<tt> [virtual]</tt>
|
|
</h3>
|
|
Paints a focus indicator on the rectangle <em>r</em> using painter <em>p</em>
|
|
and colors <em>cg</em>.
|
|
<p> <em>p</em> is already clipped.
|
|
<p> <p>See also <a href="#paintCell">paintCell</a>(), <a href="#paintBranches">paintBranches</a>(), and <a href="ntqlistview.html#allColumnsShowFocus-prop">TQListView::allColumnsShowFocus</a>.
|
|
|
|
<p>Reimplemented in <a href="qchecklistitem.html#paintFocus">TQCheckListItem</a>.
|
|
<h3 class=fn><a href="qlistviewitem.html">TQListViewItem</a> * <a name="parent"></a>TQListViewItem::parent () const
|
|
</h3>
|
|
Returns the parent of this item, or 0 if this item has no parent.
|
|
<p> <p>See also <a href="#firstChild">firstChild</a>() and <a href="#nextSibling">nextSibling</a>().
|
|
|
|
<p>Examples: <a href="dirview-example.html#x1688">dirview/dirview.cpp</a> and <a href="qaxcontainer-example-qutlook.html#x2727">qutlook/centralwidget.cpp</a>.
|
|
<h3 class=fn>const <a href="ntqpixmap.html">TQPixmap</a> * <a name="pixmap"></a>TQListViewItem::pixmap ( int column ) const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns the pixmap for <em>column</em>, or 0 if there is no pixmap for
|
|
<em>column</em>.
|
|
<p> <p>See also <a href="#setText">setText</a>() and <a href="#setPixmap">setPixmap</a>().
|
|
|
|
<p>Example: <a href="dirview-example.html#x1689">dirview/dirview.cpp</a>.
|
|
<h3 class=fn>void <a name="removeItem"></a>TQListViewItem::removeItem ( <a href="qlistviewitem.html">TQListViewItem</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>bool <a name="renameEnabled"></a>TQListViewItem::renameEnabled ( int col ) const
|
|
</h3>
|
|
Returns TRUE if this item can be in-place renamed in column <em>col</em>; otherwise returns FALSE.
|
|
|
|
<h3 class=fn>void <a name="repaint"></a>TQListViewItem::repaint () const
|
|
</h3>
|
|
Repaints this item on the screen if it is currently visible.
|
|
|
|
<p>Example: <a href="addressbook-example.html#x593">addressbook/centralwidget.cpp</a>.
|
|
<h3 class=fn>int <a name="rtti"></a>TQListViewItem::rtti () const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns 0.
|
|
<p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), so
|
|
that you can distinguish between different kinds of list view
|
|
items. You should use values greater than 1000 to allow for
|
|
extensions to this class.
|
|
|
|
<p>Reimplemented in <a href="qchecklistitem.html#rtti">TQCheckListItem</a>.
|
|
<h3 class=fn>void <a name="setDragEnabled"></a>TQListViewItem::setDragEnabled ( bool allow )<tt> [virtual]</tt>
|
|
</h3>
|
|
If <em>allow</em> is TRUE, the list view starts a drag (see
|
|
<a href="ntqlistview.html#dragObject">TQListView::dragObject</a>()) when the user presses and moves the mouse
|
|
on this item.
|
|
|
|
<h3 class=fn>void <a name="setDropEnabled"></a>TQListViewItem::setDropEnabled ( bool allow )<tt> [virtual]</tt>
|
|
</h3>
|
|
If <em>allow</em> is TRUE, the list view accepts drops onto the item;
|
|
otherwise drops are not allowed.
|
|
|
|
<h3 class=fn>void <a name="setEnabled"></a>TQListViewItem::setEnabled ( bool b )<tt> [virtual]</tt>
|
|
</h3>
|
|
If <em>b</em> is TRUE the item is enabled; otherwise it is disabled.
|
|
Disabled items are drawn differently (e.g. grayed-out) and are not
|
|
accessible by the user.
|
|
|
|
<h3 class=fn>void <a name="setExpandable"></a>TQListViewItem::setExpandable ( bool enable )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets this item to be expandable even if it has no children if <em>enable</em> is TRUE, and to be expandable only if it has children if <em>enable</em> is FALSE (the default).
|
|
<p> The dirview example uses this in the canonical fashion. It checks
|
|
whether the directory is empty in <a href="#setup">setup</a>() and calls
|
|
<a href="#setExpandable">setExpandable</a>(TRUE) if not; in <a href="#setOpen">setOpen</a>() it reads the contents of
|
|
the directory and inserts items accordingly. This strategy means
|
|
that dirview can display the entire file system without reading
|
|
very much at startup.
|
|
<p> Note that root items are not expandable by the user unless
|
|
<a href="ntqlistview.html#setRootIsDecorated">TQListView::setRootIsDecorated</a>() is set to TRUE.
|
|
<p> <p>See also <a href="#setSelectable">setSelectable</a>().
|
|
|
|
<h3 class=fn>void <a name="setHeight"></a>TQListViewItem::setHeight ( int height )<tt> [virtual protected]</tt>
|
|
</h3>
|
|
Sets this item's height to <em>height</em> pixels. This implicitly
|
|
changes <a href="#totalHeight">totalHeight</a>(), too.
|
|
<p> Note that a font change causes this height to be overwritten
|
|
unless you reimplement <a href="#setup">setup</a>().
|
|
<p> For best results in Windows style we suggest using an even number
|
|
of pixels.
|
|
<p> <p>See also <a href="#height">height</a>(), <a href="#totalHeight">totalHeight</a>(), and <a href="#isOpen">isOpen</a>().
|
|
|
|
<h3 class=fn>void <a name="setMultiLinesEnabled"></a>TQListViewItem::setMultiLinesEnabled ( bool b )<tt> [virtual]</tt>
|
|
</h3>
|
|
If <em>b</em> is TRUE each of the item's columns may contain multiple
|
|
lines of text; otherwise each of them may only contain a single
|
|
line.
|
|
|
|
<h3 class=fn>void <a name="setOpen"></a>TQListViewItem::setOpen ( bool o )<tt> [virtual]</tt>
|
|
</h3>
|
|
Opens or closes an item, i.e. shows or hides an item's children.
|
|
<p> If <em>o</em> is TRUE all child items are shown initially. The user can
|
|
hide them by clicking the <b>-</b> icon to the left of the item.
|
|
If <em>o</em> is FALSE, the children of this item are initially hidden.
|
|
The user can show them by clicking the <b>+</b> icon to the left
|
|
of the item.
|
|
<p> <p>See also <a href="#height">height</a>(), <a href="#totalHeight">totalHeight</a>(), and <a href="#isOpen">isOpen</a>().
|
|
|
|
<p>Examples: <a href="checklists-example.html#x431">checklists/checklists.cpp</a>, <a href="dirview-example.html#x1690">dirview/dirview.cpp</a>, <a href="dirview-example.html#x1718">dirview/main.cpp</a>, <a href="fileiconview-example.html#x887">fileiconview/mainwindow.cpp</a>, and <a href="tagreader-with-features-example.html#x1966">xml/tagreader-with-features/structureparser.cpp</a>.
|
|
<h3 class=fn>void <a name="setPixmap"></a>TQListViewItem::setPixmap ( int column, const <a href="ntqpixmap.html">TQPixmap</a> & pm )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the pixmap in column <em>column</em> to <em>pm</em>, if <em>pm</em> is non-null
|
|
and different from the current pixmap, and if <em>column</em> is
|
|
non-negative.
|
|
<p> <p>See also <a href="#pixmap">pixmap</a>() and <a href="#setText">setText</a>().
|
|
|
|
<p>Example: <a href="dirview-example.html#x1691">dirview/dirview.cpp</a>.
|
|
<h3 class=fn>void <a name="setRenameEnabled"></a>TQListViewItem::setRenameEnabled ( int col, bool b )<tt> [virtual]</tt>
|
|
</h3>
|
|
If <em>b</em> is TRUE, this item can be in-place renamed in the column
|
|
<em>col</em> by the user; otherwise it cannot be renamed in-place.
|
|
|
|
<h3 class=fn>void <a name="setSelectable"></a>TQListViewItem::setSelectable ( bool enable )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets this item to be selectable if <em>enable</em> is TRUE (the
|
|
default) or not to be selectable if <em>enable</em> is FALSE.
|
|
<p> The user is not able to select a non-selectable item using either
|
|
the keyboard or the mouse. This also applies for the application
|
|
programmer (e.g. <a href="#setSelected">setSelected</a>() respects this value).
|
|
<p> <p>See also <a href="#isSelectable">isSelectable</a>().
|
|
|
|
<h3 class=fn>void <a name="setSelected"></a>TQListViewItem::setSelected ( bool s )<tt> [virtual]</tt>
|
|
</h3>
|
|
If <em>s</em> is TRUE this item is selected; otherwise it is deselected.
|
|
<p> This function does not maintain any invariants or repaint anything
|
|
-- <a href="ntqlistview.html#setSelected">TQListView::setSelected</a>() does that.
|
|
<p> <p>See also <a href="#height">height</a>() and <a href="#totalHeight">totalHeight</a>().
|
|
|
|
<p>Example: <a href="addressbook-example.html#x594">addressbook/centralwidget.cpp</a>.
|
|
<h3 class=fn>void <a name="setText"></a>TQListViewItem::setText ( int column, const <a href="ntqstring.html">TQString</a> & text )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sets the text in column <em>column</em> to <em>text</em>, if <em>column</em> is a
|
|
valid column number and <em>text</em> is different from the existing
|
|
text.
|
|
<p> If <em>text()</em> has been reimplemented, this function may be a no-op.
|
|
<p> <p>See also <a href="#text">text</a>() and <a href="#key">key</a>().
|
|
|
|
<p>Examples: <a href="addressbook-example.html#x595">addressbook/centralwidget.cpp</a>, <a href="qaxcontainer-example-qutlook.html#x2728">qutlook/centralwidget.cpp</a>, and <a href="outliner-example.html#x1916">xml/outliner/outlinetree.cpp</a>.
|
|
<h3 class=fn>void <a name="setVisible"></a>TQListViewItem::setVisible ( bool b )
|
|
</h3>
|
|
If <em>b</em> is TRUE, the item is made visible; otherwise it is hidden.
|
|
<p> If the item is not visible, <a href="#itemAbove">itemAbove</a>() and <a href="#itemBelow">itemBelow</a>() will never
|
|
return this item, although you still can reach it by using e.g.
|
|
<a href="qlistviewitemiterator.html">TQListViewItemIterator</a>.
|
|
|
|
<h3 class=fn>void <a name="setup"></a>TQListViewItem::setup ()<tt> [virtual]</tt>
|
|
</h3>
|
|
This virtual function is called before the first time <a href="ntqlistview.html">TQListView</a>
|
|
needs to know the height or any other graphical attribute of this
|
|
object, and whenever the font, GUI style, or colors of the list
|
|
view change.
|
|
<p> The default calls <a href="#widthChanged">widthChanged</a>() and sets the item's height to the
|
|
height of a single line of text in the list view's font. (If you
|
|
use icons, multi-line text, etc., you will probably need to call
|
|
<a href="#setHeight">setHeight</a>() yourself or reimplement it.)
|
|
|
|
<p>Example: <a href="dirview-example.html#x1692">dirview/dirview.cpp</a>.
|
|
<h3 class=fn>void <a name="sort"></a>TQListViewItem::sort ()<tt> [virtual]</tt>
|
|
</h3>
|
|
Sorts all this item's child items using the current sorting
|
|
configuration (sort column and direction).
|
|
<p> <p>See also <a href="#enforceSortOrder">enforceSortOrder</a>().
|
|
|
|
<h3 class=fn>void <a name="sortChildItems"></a>TQListViewItem::sortChildItems ( int column, bool ascending )<tt> [virtual]</tt>
|
|
</h3>
|
|
Sorts this item's children using column <em>column</em>. This is done in
|
|
ascending order if <em>ascending</em> is TRUE and in descending order if
|
|
<em>ascending</em> is FALSE.
|
|
<p> Asks some of the children to sort their children. (<a href="ntqlistview.html">TQListView</a> and
|
|
TQListViewItem ensure that all on-screen objects are properly
|
|
sorted but may avoid or defer sorting other objects in order to be
|
|
more responsive.)
|
|
<p> <p>See also <a href="#key">key</a>() and <a href="#compare">compare</a>().
|
|
|
|
<h3 class=fn>void <a name="startRename"></a>TQListViewItem::startRename ( int col )<tt> [virtual]</tt>
|
|
</h3>
|
|
If in-place renaming of this item is enabled (see
|
|
<a href="#renameEnabled">renameEnabled</a>()), this function starts renaming the item in column
|
|
<em>col</em>, by creating and initializing an edit box.
|
|
|
|
<h3 class=fn>void <a name="takeItem"></a>TQListViewItem::takeItem ( <a href="qlistviewitem.html">TQListViewItem</a> * item )<tt> [virtual]</tt>
|
|
</h3>
|
|
Removes <em>item</em> from this object's list of children and causes an
|
|
update of the screen display. The item is not deleted. You should
|
|
not normally need to call this function because
|
|
<a href="#~TQListViewItem">TQListViewItem::~TQListViewItem</a>() calls it.
|
|
<p> The normal way to delete an item is to use <tt>delete</tt>.
|
|
<p> If you need to move an item from one place in the hierarchy to
|
|
another you can use <a href="#takeItem">takeItem</a>() to remove the item from the list
|
|
view and then <a href="#insertItem">insertItem</a>() to put the item back in its new
|
|
position.
|
|
<p> If a taken item is part of a selection in <tt>Single</tt> selection
|
|
mode, it is unselected and selectionChanged() is emitted. If a
|
|
taken item is part of a selection in <tt>Multi</tt> or <tt>Extended</tt>
|
|
selection mode, it remains selected.
|
|
<p> <b>Warning:</b> This function leaves <em>item</em> and its children in a state
|
|
where most member functions are unsafe. Only a few functions work
|
|
correctly on an item in this state, most notably insertItem(). The
|
|
functions that work on taken items are explicitly documented as
|
|
such.
|
|
<p> <p>See also <a href="#insertItem">TQListViewItem::insertItem</a>().
|
|
|
|
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text"></a>TQListViewItem::text ( int column ) const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns the text in column <em>column</em>, or <a href="ntqstring.html#TQString-null">TQString::null</a> if there is
|
|
no text in that column.
|
|
<p> <p>See also <a href="#key">key</a>() and <a href="#paintCell">paintCell</a>().
|
|
|
|
<p>Examples: <a href="addressbook-example.html#x596">addressbook/centralwidget.cpp</a>, <a href="dirview-example.html#x1693">dirview/dirview.cpp</a>, <a href="archivesearch-example.html#x477">network/archivesearch/archivedialog.ui.h</a>, and <a href="ftpclient-example.html#x766">network/ftpclient/ftpmainwindow.ui.h</a>.
|
|
<h3 class=fn>int <a name="totalHeight"></a>TQListViewItem::totalHeight () const
|
|
</h3>
|
|
Returns the total height of this object, including any visible
|
|
children. This height is recomputed lazily and cached for as long
|
|
as possible.
|
|
<p> Functions which can affect the total height are, <a href="#setHeight">setHeight</a>() which
|
|
is used to set an item's height, <a href="#setOpen">setOpen</a>() to show or hide an
|
|
item's children, and <a href="#invalidateHeight">invalidateHeight</a>() to invalidate the cached
|
|
height.
|
|
<p> <p>See also <a href="#height">height</a>().
|
|
|
|
<h3 class=fn>int <a name="width"></a>TQListViewItem::width ( const <a href="ntqfontmetrics.html">TQFontMetrics</a> & fm, const <a href="ntqlistview.html">TQListView</a> * lv, int c ) const<tt> [virtual]</tt>
|
|
</h3>
|
|
Returns the number of pixels of width required to draw column <em>c</em>
|
|
of list view <em>lv</em>, using the metrics <em>fm</em> without cropping. The
|
|
list view containing this item may use this information depending
|
|
on the TQListView::WidthMode settings for the column.
|
|
<p> The default implementation returns the width of the bounding
|
|
rectangle of the text of column <em>c</em>.
|
|
<p> <p>See also <a href="#listView">listView</a>(), <a href="#widthChanged">widthChanged</a>(), <a href="ntqlistview.html#setColumnWidthMode">TQListView::setColumnWidthMode</a>(), and <a href="ntqlistview.html#itemMargin-prop">TQListView::itemMargin</a>.
|
|
|
|
<h3 class=fn>void <a name="widthChanged"></a>TQListViewItem::widthChanged ( int c = -1 ) const
|
|
</h3>
|
|
Call this function when the value of <a href="#width">width</a>() may have changed for
|
|
column <em>c</em>. Normally, you should call this if <a href="#text">text</a>(c) changes.
|
|
Passing -1 for <em>c</em> indicates that all columns may have changed.
|
|
It is more efficient to pass -1 if two or more columns have
|
|
changed than to call <a href="#widthChanged">widthChanged</a>() separately for each one.
|
|
<p> <p>See also <a href="#width">width</a>().
|
|
|
|
<!-- eof -->
|
|
<hr><p>
|
|
This file is part of the <a href="index.html">TQt 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>TQt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|