1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qlistview.cpp:370 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QListViewItem Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QListViewItem Class Reference</h1>
|
---|
33 |
|
---|
34 | <p>The QListViewItem class implements a list view item.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qlistview-h.html">qlistview.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qt.html">Qt</a>.
|
---|
38 | <p>Inherited by <a href="qchecklistitem.html">QCheckListItem</a>.
|
---|
39 | <p><a href="qlistviewitem-members.html">List of all member functions.</a>
|
---|
40 | <h2>Public Members</h2>
|
---|
41 | <ul>
|
---|
42 | <li class=fn><a href="#QListViewItem"><b>QListViewItem</b></a> ( QListView * parent )</li>
|
---|
43 | <li class=fn><a href="#QListViewItem-2"><b>QListViewItem</b></a> ( QListViewItem * parent )</li>
|
---|
44 | <li class=fn><a href="#QListViewItem-3"><b>QListViewItem</b></a> ( QListView * parent, QListViewItem * after )</li>
|
---|
45 | <li class=fn><a href="#QListViewItem-4"><b>QListViewItem</b></a> ( QListViewItem * parent, QListViewItem * after )</li>
|
---|
46 | <li class=fn><a href="#QListViewItem-5"><b>QListViewItem</b></a> ( QListView * parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null )</li>
|
---|
47 | <li class=fn><a href="#QListViewItem-6"><b>QListViewItem</b></a> ( QListViewItem * parent, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null )</li>
|
---|
48 | <li class=fn><a href="#QListViewItem-7"><b>QListViewItem</b></a> ( QListView * parent, QListViewItem * after, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null )</li>
|
---|
49 | <li class=fn><a href="#QListViewItem-8"><b>QListViewItem</b></a> ( QListViewItem * parent, QListViewItem * after, QString label1, QString label2 = QString::null, QString label3 = QString::null, QString label4 = QString::null, QString label5 = QString::null, QString label6 = QString::null, QString label7 = QString::null, QString label8 = QString::null )</li>
|
---|
50 | <li class=fn>virtual <a href="#~QListViewItem"><b>~QListViewItem</b></a> ()</li>
|
---|
51 | <li class=fn>virtual void <a href="#insertItem"><b>insertItem</b></a> ( QListViewItem * newChild )</li>
|
---|
52 | <li class=fn>virtual void <a href="#takeItem"><b>takeItem</b></a> ( QListViewItem * item )</li>
|
---|
53 | <li class=fn>virtual void removeItem ( QListViewItem * item ) <em>(obsolete)</em></li>
|
---|
54 | <li class=fn>int <a href="#height"><b>height</b></a> () const</li>
|
---|
55 | <li class=fn>virtual void <a href="#invalidateHeight"><b>invalidateHeight</b></a> ()</li>
|
---|
56 | <li class=fn>int <a href="#totalHeight"><b>totalHeight</b></a> () const</li>
|
---|
57 | <li class=fn>virtual int <a href="#width"><b>width</b></a> ( const QFontMetrics & fm, const QListView * lv, int c ) const</li>
|
---|
58 | <li class=fn>void <a href="#widthChanged"><b>widthChanged</b></a> ( int c = -1 ) const</li>
|
---|
59 | <li class=fn>int <a href="#depth"><b>depth</b></a> () const</li>
|
---|
60 | <li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( int column, const QString & text )</li>
|
---|
61 | <li class=fn>virtual QString <a href="#text"><b>text</b></a> ( int column ) const</li>
|
---|
62 | <li class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( int column, const QPixmap & pm )</li>
|
---|
63 | <li class=fn>virtual const QPixmap * <a href="#pixmap"><b>pixmap</b></a> ( int column ) const</li>
|
---|
64 | <li class=fn>virtual QString <a href="#key"><b>key</b></a> ( int column, bool ascending ) const</li>
|
---|
65 | <li class=fn>virtual int <a href="#compare"><b>compare</b></a> ( QListViewItem * i, int col, bool ascending ) const</li>
|
---|
66 | <li class=fn>virtual void <a href="#sortChildItems"><b>sortChildItems</b></a> ( int column, bool ascending )</li>
|
---|
67 | <li class=fn>int <a href="#childCount"><b>childCount</b></a> () const</li>
|
---|
68 | <li class=fn>bool <a href="#isOpen"><b>isOpen</b></a> () const</li>
|
---|
69 | <li class=fn>virtual void <a href="#setOpen"><b>setOpen</b></a> ( bool o )</li>
|
---|
70 | <li class=fn>virtual void <a href="#setup"><b>setup</b></a> ()</li>
|
---|
71 | <li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( bool s )</li>
|
---|
72 | <li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> () const</li>
|
---|
73 | <li class=fn>virtual void <a href="#paintCell"><b>paintCell</b></a> ( QPainter * p, const QColorGroup & cg, int column, int width, int align )</li>
|
---|
74 | <li class=fn>virtual void <a href="#paintBranches"><b>paintBranches</b></a> ( QPainter * p, const QColorGroup & cg, int w, int y, int h )</li>
|
---|
75 | <li class=fn>virtual void <a href="#paintFocus"><b>paintFocus</b></a> ( QPainter * p, const QColorGroup & cg, const QRect & r )</li>
|
---|
76 | <li class=fn>QListViewItem * <a href="#firstChild"><b>firstChild</b></a> () const</li>
|
---|
77 | <li class=fn>QListViewItem * <a href="#nextSibling"><b>nextSibling</b></a> () const</li>
|
---|
78 | <li class=fn>QListViewItem * <a href="#parent"><b>parent</b></a> () const</li>
|
---|
79 | <li class=fn>QListViewItem * <a href="#itemAbove"><b>itemAbove</b></a> ()</li>
|
---|
80 | <li class=fn>QListViewItem * <a href="#itemBelow"><b>itemBelow</b></a> ()</li>
|
---|
81 | <li class=fn>int <a href="#itemPos"><b>itemPos</b></a> () const</li>
|
---|
82 | <li class=fn>QListView * <a href="#listView"><b>listView</b></a> () const</li>
|
---|
83 | <li class=fn>virtual void <a href="#setSelectable"><b>setSelectable</b></a> ( bool enable )</li>
|
---|
84 | <li class=fn>bool <a href="#isSelectable"><b>isSelectable</b></a> () const</li>
|
---|
85 | <li class=fn>virtual void <a href="#setExpandable"><b>setExpandable</b></a> ( bool enable )</li>
|
---|
86 | <li class=fn>bool <a href="#isExpandable"><b>isExpandable</b></a> () const</li>
|
---|
87 | <li class=fn>void <a href="#repaint"><b>repaint</b></a> () const</li>
|
---|
88 | <li class=fn>virtual void <a href="#sort"><b>sort</b></a> ()</li>
|
---|
89 | <li class=fn>void <a href="#moveItem"><b>moveItem</b></a> ( QListViewItem * after )</li>
|
---|
90 | <li class=fn>virtual void <a href="#setDragEnabled"><b>setDragEnabled</b></a> ( bool allow )</li>
|
---|
91 | <li class=fn>virtual void <a href="#setDropEnabled"><b>setDropEnabled</b></a> ( bool allow )</li>
|
---|
92 | <li class=fn>bool <a href="#dragEnabled"><b>dragEnabled</b></a> () const</li>
|
---|
93 | <li class=fn>bool <a href="#dropEnabled"><b>dropEnabled</b></a> () const</li>
|
---|
94 | <li class=fn>virtual bool <a href="#acceptDrop"><b>acceptDrop</b></a> ( const QMimeSource * mime ) const</li>
|
---|
95 | <li class=fn>void <a href="#setVisible"><b>setVisible</b></a> ( bool b )</li>
|
---|
96 | <li class=fn>bool <a href="#isVisible"><b>isVisible</b></a> () const</li>
|
---|
97 | <li class=fn>virtual void <a href="#setRenameEnabled"><b>setRenameEnabled</b></a> ( int col, bool b )</li>
|
---|
98 | <li class=fn>bool <a href="#renameEnabled"><b>renameEnabled</b></a> ( int col ) const</li>
|
---|
99 | <li class=fn>virtual void <a href="#startRename"><b>startRename</b></a> ( int col )</li>
|
---|
100 | <li class=fn>virtual void <a href="#setEnabled"><b>setEnabled</b></a> ( bool b )</li>
|
---|
101 | <li class=fn>bool <a href="#isEnabled"><b>isEnabled</b></a> () const</li>
|
---|
102 | <li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
|
---|
103 | <li class=fn>virtual void <a href="#setMultiLinesEnabled"><b>setMultiLinesEnabled</b></a> ( bool b )</li>
|
---|
104 | <li class=fn>bool <a href="#multiLinesEnabled"><b>multiLinesEnabled</b></a> () const</li>
|
---|
105 | </ul>
|
---|
106 | <h2>Protected Members</h2>
|
---|
107 | <ul>
|
---|
108 | <li class=fn>virtual void <a href="#enforceSortOrder"><b>enforceSortOrder</b></a> () const</li>
|
---|
109 | <li class=fn>virtual void <a href="#setHeight"><b>setHeight</b></a> ( int height )</li>
|
---|
110 | <li class=fn>virtual void <a href="#activate"><b>activate</b></a> ()</li>
|
---|
111 | <li class=fn>bool <a href="#activatedPos"><b>activatedPos</b></a> ( QPoint & pos )</li>
|
---|
112 | <li class=fn>virtual void <a href="#dropped"><b>dropped</b></a> ( QDropEvent * e )</li>
|
---|
113 | <li class=fn>virtual void <a href="#dragEntered"><b>dragEntered</b></a> ()</li>
|
---|
114 | <li class=fn>virtual void <a href="#dragLeft"><b>dragLeft</b></a> ()</li>
|
---|
115 | <li class=fn>virtual void <a href="#okRename"><b>okRename</b></a> ( int col )</li>
|
---|
116 | <li class=fn>virtual void <a href="#cancelRename"><b>cancelRename</b></a> ( int col )</li>
|
---|
117 | </ul>
|
---|
118 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
119 |
|
---|
120 |
|
---|
121 | The QListViewItem class implements a list view item.
|
---|
122 | <p>
|
---|
123 | <p> A list view item is a multi-column object capable of displaying
|
---|
124 | itself in a <a href="qlistview.html">QListView</a>.
|
---|
125 | <p> The easiest way to use QListViewItem is to construct one with a
|
---|
126 | few constant strings, and either a QListView or another
|
---|
127 | QListViewItem as parent.
|
---|
128 | <pre>
|
---|
129 | (void) new QListViewItem( listView, "Column 1", "Column 2" );
|
---|
130 | (void) new QListViewItem( listView->firstChild(), "A", "B", "C" );
|
---|
131 | </pre>
|
---|
132 |
|
---|
133 | We've discarded the pointers to the items since we can still access
|
---|
134 | them via their parent <em>listView</em>. By default, QListView sorts its
|
---|
135 | items; this can be switched off with <a href="qlistview.html#setSorting">QListView::setSorting</a>(-1).
|
---|
136 | <p> The parent must be another QListViewItem or a QListView. If the
|
---|
137 | parent is a QListView, the item becomes a top-level item within
|
---|
138 | that QListView. If the parent is another QListViewItem, the item
|
---|
139 | becomes a child of that list view item.
|
---|
140 | <p> If you keep the pointer, you can set or change the texts using
|
---|
141 | <a href="#setText">setText</a>(), add pixmaps using <a href="#setPixmap">setPixmap</a>(), change its mode using
|
---|
142 | <a href="#setSelectable">setSelectable</a>(), <a href="#setSelected">setSelected</a>(), <a href="#setOpen">setOpen</a>() and <a href="#setExpandable">setExpandable</a>().
|
---|
143 | You'll also be able to change its height using <a href="#setHeight">setHeight</a>(), and
|
---|
144 | traverse its sub-items. You don't have to keep the pointer since
|
---|
145 | you can get a pointer to any QListViewItem in a <a href="qlistview.html">QListView</a> using
|
---|
146 | <a href="qlistview.html#selectedItem">QListView::selectedItem</a>(), <a href="qlistview.html#currentItem">QListView::currentItem</a>(),
|
---|
147 | <a href="qlistview.html#firstChild">QListView::firstChild</a>(), <a href="qlistview.html#lastItem">QListView::lastItem</a>() and
|
---|
148 | <a href="qlistview.html#findItem">QListView::findItem</a>().
|
---|
149 | <p> If you call <tt>delete</tt> on a list view item, it will be deleted as
|
---|
150 | expected, and as usual for <a href="qobject.html">QObject</a>s, if it has any child items
|
---|
151 | (to any depth), all these will be deleted too.
|
---|
152 | <p> <a href="qchecklistitem.html">QCheckListItem</a>s are list view items that have a checkbox or
|
---|
153 | radio button and can be used in place of plain QListViewItems.
|
---|
154 | <p> You can traverse the tree as if it were a doubly-linked list using
|
---|
155 | <a href="#itemAbove">itemAbove</a>() and <a href="#itemBelow">itemBelow</a>(); they return pointers to the items
|
---|
156 | directly above and below this item on the screen (even if none of
|
---|
157 | them are actually visible at the moment).
|
---|
158 | <p> Here's how to traverse all of an item's children (but not its
|
---|
159 | children's children, etc.):
|
---|
160 | Example:
|
---|
161 | <pre>
|
---|
162 | QListViewItem * myChild = myItem->firstChild();
|
---|
163 | while( myChild ) {
|
---|
164 | doSomething( myChild );
|
---|
165 | myChild = myChild-><a href="#nextSibling">nextSibling</a>();
|
---|
166 | }
|
---|
167 | </pre>
|
---|
168 |
|
---|
169 | <p> If you want to iterate over every item, to any level of depth use
|
---|
170 | an iterator. To iterate over the entire tree, initialize the
|
---|
171 | iterator with the list view itself; to iterate starting from a
|
---|
172 | particular item, initialize the iterator with the item:
|
---|
173 | <p> <pre>
|
---|
174 | <a href="qlistviewitemiterator.html">QListViewItemIterator</a> it( listview );
|
---|
175 | while ( it.<a href="qlistviewitemiterator.html#current">current</a>() ) {
|
---|
176 | QListViewItem *item = it.<a href="qlistviewitemiterator.html#current">current</a>();
|
---|
177 | doSomething( item );
|
---|
178 | ++it;
|
---|
179 | }
|
---|
180 | </pre>
|
---|
181 |
|
---|
182 | <p> Note that the order of the children will change when the sorting
|
---|
183 | order changes and is undefined if the items are not visible. You
|
---|
184 | can, however, call <a href="#enforceSortOrder">enforceSortOrder</a>() at any time; <a href="qlistview.html">QListView</a> will
|
---|
185 | always call it before it needs to show an item.
|
---|
186 | <p> Many programs will need to reimplement QListViewItem. The most
|
---|
187 | commonly reimplemented functions are:
|
---|
188 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
189 | <tr bgcolor="#a2c511"> <th valign="top">Function <th valign="top">Description
|
---|
190 | <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#text">text</a>()
|
---|
191 | <td valign="top">Returns the text in a column. Many subclasses will compute
|
---|
192 | this on the fly.
|
---|
193 | <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#key">key</a>()
|
---|
194 | <td valign="top">Used for sorting. The default <a href="#key">key</a>() simply calls
|
---|
195 | <a href="#text">text</a>(), but judicious use of key() can give you fine
|
---|
196 | control over sorting; for example, <a href="qfiledialog.html">QFileDialog</a>
|
---|
197 | reimplements key() to sort by date.
|
---|
198 | <tr bgcolor="#f0f0f0"> <td valign="top"><a href="#setup">setup</a>()
|
---|
199 | <td valign="top">Called before showing the item and whenever the list
|
---|
200 | view's font changes, for example.
|
---|
201 | <tr bgcolor="#d0d0d0"> <td valign="top"><a href="#activate">activate</a>()
|
---|
202 | <td valign="top">Called whenever the user clicks on the item or presses
|
---|
203 | Space when the item is the current item.
|
---|
204 | </table></center>
|
---|
205 | <p> Some subclasses call <a href="#setExpandable">setExpandable</a>(TRUE) even when they have no
|
---|
206 | children, and populate themselves when <a href="#setup">setup</a>() or <a href="#setOpen">setOpen</a>(TRUE) is
|
---|
207 | called. The <a href="dirview-example.html">dirview/dirview.cpp</a> example program uses this
|
---|
208 | technique to start up quickly: The files and subdirectories in a
|
---|
209 | directory aren't inserted into the tree until they're actually
|
---|
210 | needed.
|
---|
211 | <p> <center><img src="qlistviewitems.png" alt="List View Items"></center>
|
---|
212 | <p> <p>See also <a href="qchecklistitem.html">QCheckListItem</a>, <a href="qlistview.html">QListView</a>, and <a href="advanced.html">Advanced Widgets</a>.
|
---|
213 |
|
---|
214 | <hr><h2>Member Function Documentation</h2>
|
---|
215 | <h3 class=fn><a name="QListViewItem"></a>QListViewItem::QListViewItem ( <a href="qlistview.html">QListView</a> * parent )
|
---|
216 | </h3>
|
---|
217 | Constructs a new top-level list view item in the <a href="qlistview.html">QListView</a> <em>parent</em>.
|
---|
218 |
|
---|
219 | <h3 class=fn><a name="QListViewItem-2"></a>QListViewItem::QListViewItem ( <a href="qlistviewitem.html">QListViewItem</a> * parent )
|
---|
220 | </h3>
|
---|
221 | Constructs a new list view item that is a child of <em>parent</em> and
|
---|
222 | first in the parent's list of children.
|
---|
223 |
|
---|
224 | <h3 class=fn><a name="QListViewItem-3"></a>QListViewItem::QListViewItem ( <a href="qlistview.html">QListView</a> * parent, <a href="qlistviewitem.html">QListViewItem</a> * after )
|
---|
225 | </h3>
|
---|
226 | Constructs an empty list view item that is a child of <em>parent</em>
|
---|
227 | and is after item <em>after</em> in the parent's list of children. Since
|
---|
228 | <em>parent</em> is a <a href="qlistview.html">QListView</a> the item will be a top-level item.
|
---|
229 |
|
---|
230 | <h3 class=fn><a name="QListViewItem-4"></a>QListViewItem::QListViewItem ( <a href="qlistviewitem.html">QListViewItem</a> * parent, <a href="qlistviewitem.html">QListViewItem</a> * after )
|
---|
231 | </h3>
|
---|
232 | Constructs an empty list view item that is a child of <em>parent</em>
|
---|
233 | and is after item <em>after</em> in the parent's list of children.
|
---|
234 |
|
---|
235 | <h3 class=fn><a name="QListViewItem-5"></a>QListViewItem::QListViewItem ( <a href="qlistview.html">QListView</a> * parent, <a href="qstring.html">QString</a> label1, <a href="qstring.html">QString</a> label2 = QString::null, <a href="qstring.html">QString</a> label3 = QString::null, <a href="qstring.html">QString</a> label4 = QString::null, <a href="qstring.html">QString</a> label5 = QString::null, <a href="qstring.html">QString</a> label6 = QString::null, <a href="qstring.html">QString</a> label7 = QString::null, <a href="qstring.html">QString</a> label8 = QString::null )
|
---|
236 | </h3>
|
---|
237 | Constructs a new top-level list view item in the <a href="qlistview.html">QListView</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>
|
---|
238 | defining its columns' contents.
|
---|
239 | <p> <p>See also <a href="#setText">setText</a>().
|
---|
240 |
|
---|
241 | <h3 class=fn><a name="QListViewItem-6"></a>QListViewItem::QListViewItem ( <a href="qlistviewitem.html">QListViewItem</a> * parent, <a href="qstring.html">QString</a> label1, <a href="qstring.html">QString</a> label2 = QString::null, <a href="qstring.html">QString</a> label3 = QString::null, <a href="qstring.html">QString</a> label4 = QString::null, <a href="qstring.html">QString</a> label5 = QString::null, <a href="qstring.html">QString</a> label6 = QString::null, <a href="qstring.html">QString</a> label7 = QString::null, <a href="qstring.html">QString</a> label8 = QString::null )
|
---|
242 | </h3>
|
---|
243 | Constructs a new list view item as a child of the QListViewItem <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>
|
---|
244 | as columns' contents.
|
---|
245 | <p> <p>See also <a href="#setText">setText</a>().
|
---|
246 |
|
---|
247 | <h3 class=fn><a name="QListViewItem-7"></a>QListViewItem::QListViewItem ( <a href="qlistview.html">QListView</a> * parent, <a href="qlistviewitem.html">QListViewItem</a> * after, <a href="qstring.html">QString</a> label1, <a href="qstring.html">QString</a> label2 = QString::null, <a href="qstring.html">QString</a> label3 = QString::null, <a href="qstring.html">QString</a> label4 = QString::null, <a href="qstring.html">QString</a> label5 = QString::null, <a href="qstring.html">QString</a> label6 = QString::null, <a href="qstring.html">QString</a> label7 = QString::null, <a href="qstring.html">QString</a> label8 = QString::null )
|
---|
248 | </h3>
|
---|
249 | Constructs a new list view item in the <a href="qlistview.html">QListView</a> <em>parent</em> that is
|
---|
250 | included after item <em>after</em> and that has up to eight column
|
---|
251 | 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>.
|
---|
252 | <p> Note that the order is changed according to <a href="#key">QListViewItem::key</a>()
|
---|
253 | unless the list view's sorting is disabled using
|
---|
254 | <a href="qlistview.html#setSorting">QListView::setSorting</a>(-1).
|
---|
255 | <p> <p>See also <a href="#setText">setText</a>().
|
---|
256 |
|
---|
257 | <h3 class=fn><a name="QListViewItem-8"></a>QListViewItem::QListViewItem ( <a href="qlistviewitem.html">QListViewItem</a> * parent, <a href="qlistviewitem.html">QListViewItem</a> * after, <a href="qstring.html">QString</a> label1, <a href="qstring.html">QString</a> label2 = QString::null, <a href="qstring.html">QString</a> label3 = QString::null, <a href="qstring.html">QString</a> label4 = QString::null, <a href="qstring.html">QString</a> label5 = QString::null, <a href="qstring.html">QString</a> label6 = QString::null, <a href="qstring.html">QString</a> label7 = QString::null, <a href="qstring.html">QString</a> label8 = QString::null )
|
---|
258 | </h3>
|
---|
259 | Constructs a new list view item as a child of the QListViewItem <em>parent</em>. It is inserted after item <em>after</em> and may contain up to
|
---|
260 | 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.
|
---|
261 | <p> Note that the order is changed according to <a href="#key">QListViewItem::key</a>()
|
---|
262 | unless the list view's sorting is disabled using
|
---|
263 | <a href="qlistview.html#setSorting">QListView::setSorting</a>(-1).
|
---|
264 | <p> <p>See also <a href="#setText">setText</a>().
|
---|
265 |
|
---|
266 | <h3 class=fn><a name="~QListViewItem"></a>QListViewItem::~QListViewItem ()<tt> [virtual]</tt>
|
---|
267 | </h3>
|
---|
268 | Destroys the item, deleting all its children and freeing up all
|
---|
269 | allocated resources.
|
---|
270 |
|
---|
271 | <h3 class=fn>bool <a name="acceptDrop"></a>QListViewItem::acceptDrop ( const <a href="qmimesource.html">QMimeSource</a> * mime ) const<tt> [virtual]</tt>
|
---|
272 | </h3>
|
---|
273 | Returns TRUE if the item can accept drops of type <a href="qmimesource.html">QMimeSource</a> <em>mime</em>; otherwise returns FALSE.
|
---|
274 | <p> The default implementation does nothing and returns FALSE. A
|
---|
275 | subclass must reimplement this to accept drops.
|
---|
276 |
|
---|
277 | <h3 class=fn>void <a name="activate"></a>QListViewItem::activate ()<tt> [virtual protected]</tt>
|
---|
278 | </h3>
|
---|
279 | This virtual function is called whenever the user presses the mouse
|
---|
280 | on this item or presses Space on it.
|
---|
281 | <p> <p>See also <a href="#activatedPos">activatedPos</a>().
|
---|
282 |
|
---|
283 | <p>Reimplemented in <a href="qchecklistitem.html#activate">QCheckListItem</a>.
|
---|
284 | <h3 class=fn>bool <a name="activatedPos"></a>QListViewItem::activatedPos ( <a href="qpoint.html">QPoint</a> & pos )<tt> [protected]</tt>
|
---|
285 | </h3>
|
---|
286 | When called from a reimplementation of <a href="#activate">activate</a>(), this function
|
---|
287 | gives information on how the item was activated. Otherwise the
|
---|
288 | behavior is undefined.
|
---|
289 | <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
|
---|
290 | returns FALSE and does not change <em>pos</em>.
|
---|
291 | <p> <em>pos</em> is relative to the top-left corner of this item.
|
---|
292 | <p> <b>Warning:</b> We recommend that you ignore this function; it is
|
---|
293 | scheduled to become obsolete.
|
---|
294 | <p> <p>See also <a href="#activate">activate</a>().
|
---|
295 |
|
---|
296 | <h3 class=fn>void <a name="cancelRename"></a>QListViewItem::cancelRename ( int col )<tt> [virtual protected]</tt>
|
---|
297 | </h3>
|
---|
298 | This function is called if the user cancels in-place renaming of
|
---|
299 | this item in column <em>col</em> (e.g. by pressing Esc).
|
---|
300 | <p> <p>See also <a href="#okRename">okRename</a>().
|
---|
301 |
|
---|
302 | <h3 class=fn>int <a name="childCount"></a>QListViewItem::childCount () const
|
---|
303 | </h3>
|
---|
304 |
|
---|
305 | <p> Returns how many children this item has. The count only includes
|
---|
306 | the item's immediate children.
|
---|
307 |
|
---|
308 | <h3 class=fn>int <a name="compare"></a>QListViewItem::compare ( <a href="qlistviewitem.html">QListViewItem</a> * i, int col, bool ascending ) const<tt> [virtual]</tt>
|
---|
309 | </h3>
|
---|
310 | 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
|
---|
311 | they are equal and > 0 if this item is greater than <em>i</em>.
|
---|
312 | <p> This function is used for sorting.
|
---|
313 | <p> The default implementation compares the item keys (<a href="#key">key</a>()) using
|
---|
314 | <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>(). A reimplementation can use
|
---|
315 | different values and a different comparison function. Here is a
|
---|
316 | reimplementation that uses plain Unicode comparison:
|
---|
317 | <p> <pre>
|
---|
318 | int MyListViewItem::compare( QListViewItem *i, int col,
|
---|
319 | bool ascending ) const
|
---|
320 | {
|
---|
321 | return key( col, ascending ).compare( i-><a href="#key">key</a>( col, ascending) );
|
---|
322 | }
|
---|
323 | </pre>
|
---|
324 |
|
---|
325 | We don't recommend using <em>ascending</em> so your code can safely
|
---|
326 | ignore it.
|
---|
327 | <p> <p>See also <a href="#key">key</a>(), <a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>(), and <a href="qstring.html#compare">QString::compare</a>().
|
---|
328 |
|
---|
329 | <h3 class=fn>int <a name="depth"></a>QListViewItem::depth () const
|
---|
330 | </h3>
|
---|
331 | Returns the depth of this item.
|
---|
332 |
|
---|
333 | <p>Example: <a href="dirview-example.html#x1686">dirview/dirview.cpp</a>.
|
---|
334 | <h3 class=fn>bool <a name="dragEnabled"></a>QListViewItem::dragEnabled () const
|
---|
335 | </h3>
|
---|
336 | Returns TRUE if this item can be dragged; otherwise returns FALSE.
|
---|
337 | <p> <p>See also <a href="#setDragEnabled">setDragEnabled</a>().
|
---|
338 |
|
---|
339 | <h3 class=fn>void <a name="dragEntered"></a>QListViewItem::dragEntered ()<tt> [virtual protected]</tt>
|
---|
340 | </h3>
|
---|
341 | This function is called when a drag enters the item's bounding
|
---|
342 | rectangle.
|
---|
343 | <p> The default implementation does nothing, subclasses may need to
|
---|
344 | reimplement this function.
|
---|
345 |
|
---|
346 | <h3 class=fn>void <a name="dragLeft"></a>QListViewItem::dragLeft ()<tt> [virtual protected]</tt>
|
---|
347 | </h3>
|
---|
348 | This function is called when a drag leaves the item's bounding
|
---|
349 | rectangle.
|
---|
350 | <p> The default implementation does nothing, subclasses may need to
|
---|
351 | reimplement this function.
|
---|
352 |
|
---|
353 | <h3 class=fn>bool <a name="dropEnabled"></a>QListViewItem::dropEnabled () const
|
---|
354 | </h3>
|
---|
355 | Returns TRUE if this item accepts drops; otherwise returns FALSE.
|
---|
356 | <p> <p>See also <a href="#setDropEnabled">setDropEnabled</a>() and <a href="#acceptDrop">acceptDrop</a>().
|
---|
357 |
|
---|
358 | <h3 class=fn>void <a name="dropped"></a>QListViewItem::dropped ( <a href="qdropevent.html">QDropEvent</a> * e )<tt> [virtual protected]</tt>
|
---|
359 | </h3>
|
---|
360 | This function is called when something was dropped on the item. <em>e</em>
|
---|
361 | contains all the information about the drop.
|
---|
362 | <p> The default implementation does nothing, subclasses may need to
|
---|
363 | reimplement this function.
|
---|
364 |
|
---|
365 | <h3 class=fn>void <a name="enforceSortOrder"></a>QListViewItem::enforceSortOrder () const<tt> [virtual protected]</tt>
|
---|
366 | </h3>
|
---|
367 | Makes sure that this object's children are sorted appropriately.
|
---|
368 | <p> This only works if every item from the root item down to this item
|
---|
369 | is already sorted.
|
---|
370 | <p> <p>See also <a href="#sortChildItems">sortChildItems</a>().
|
---|
371 |
|
---|
372 | <h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="firstChild"></a>QListViewItem::firstChild () const
|
---|
373 | </h3>
|
---|
374 | Returns the first (top) child of this item, or 0 if this item has
|
---|
375 | no children.
|
---|
376 | <p> Note that the children are not guaranteed to be sorted properly.
|
---|
377 | <a href="qlistview.html">QListView</a> and QListViewItem try to postpone or avoid sorting to
|
---|
378 | the greatest degree possible, in order to keep the user interface
|
---|
379 | snappy.
|
---|
380 | <p> <p>See also <a href="#nextSibling">nextSibling</a>() and <a href="#sortChildItems">sortChildItems</a>().
|
---|
381 |
|
---|
382 | <p>Example: <a href="checklists-example.html#x430">checklists/checklists.cpp</a>.
|
---|
383 | <h3 class=fn>int <a name="height"></a>QListViewItem::height () const
|
---|
384 | </h3>
|
---|
385 | Returns the height of this item in pixels. This does not include
|
---|
386 | the height of any children; <a href="#totalHeight">totalHeight</a>() returns that.
|
---|
387 |
|
---|
388 | <h3 class=fn>void <a name="insertItem"></a>QListViewItem::insertItem ( <a href="qlistviewitem.html">QListViewItem</a> * newChild )<tt> [virtual]</tt>
|
---|
389 | </h3>
|
---|
390 | Inserts <em>newChild</em> into this list view item's list of children.
|
---|
391 | You should not need to call this function; it is called
|
---|
392 | automatically by the constructor of <em>newChild</em>.
|
---|
393 | <p> <b>Warning:</b> If you are using <tt>Single</tt> selection mode, then you
|
---|
394 | should only insert unselected items.
|
---|
395 |
|
---|
396 | <h3 class=fn>void <a name="invalidateHeight"></a>QListViewItem::invalidateHeight ()<tt> [virtual]</tt>
|
---|
397 | </h3>
|
---|
398 | Invalidates the cached total height of this item, including all
|
---|
399 | open children.
|
---|
400 | <p> <p>See also <a href="#setHeight">setHeight</a>(), <a href="#height">height</a>(), and <a href="#totalHeight">totalHeight</a>().
|
---|
401 |
|
---|
402 | <h3 class=fn>bool <a name="isEnabled"></a>QListViewItem::isEnabled () const
|
---|
403 | </h3>
|
---|
404 | Returns TRUE if this item is enabled; otherwise returns FALSE.
|
---|
405 | <p> <p>See also <a href="#setEnabled">setEnabled</a>().
|
---|
406 |
|
---|
407 | <h3 class=fn>bool <a name="isExpandable"></a>QListViewItem::isExpandable () const
|
---|
408 | </h3>
|
---|
409 |
|
---|
410 | <p> Returns TRUE if this item is expandable even when it has no
|
---|
411 | children; otherwise returns FALSE.
|
---|
412 |
|
---|
413 | <h3 class=fn>bool <a name="isOpen"></a>QListViewItem::isOpen () const
|
---|
414 | </h3>
|
---|
415 |
|
---|
416 | <p> Returns TRUE if this list view item has children <em>and</em> they are
|
---|
417 | not explicitly hidden; otherwise returns FALSE.
|
---|
418 | <p> <p>See also <a href="#setOpen">setOpen</a>().
|
---|
419 |
|
---|
420 | <h3 class=fn>bool <a name="isSelectable"></a>QListViewItem::isSelectable () const
|
---|
421 | </h3>
|
---|
422 |
|
---|
423 | <p> Returns TRUE if the item is selectable (as it is by default);
|
---|
424 | otherwise returns FALSE
|
---|
425 | <p> <p>See also <a href="#setSelectable">setSelectable</a>().
|
---|
426 |
|
---|
427 | <h3 class=fn>bool <a name="isSelected"></a>QListViewItem::isSelected () const
|
---|
428 | </h3>
|
---|
429 |
|
---|
430 | <p> Returns TRUE if this item is selected; otherwise returns FALSE.
|
---|
431 | <p> <p>See also <a href="#setSelected">setSelected</a>(), <a href="qlistview.html#setSelected">QListView::setSelected</a>(), and <a href="qlistview.html#selectionChanged">QListView::selectionChanged</a>().
|
---|
432 |
|
---|
433 | <p>Example: <a href="listviews-example.html#x156">listviews/listviews.cpp</a>.
|
---|
434 | <h3 class=fn>bool <a name="isVisible"></a>QListViewItem::isVisible () const
|
---|
435 | </h3>
|
---|
436 | Returns TRUE if the item is visible; otherwise returns FALSE.
|
---|
437 | <p> <p>See also <a href="#setVisible">setVisible</a>().
|
---|
438 |
|
---|
439 | <h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="itemAbove"></a>QListViewItem::itemAbove ()
|
---|
440 | </h3>
|
---|
441 | Returns a pointer to the item immediately above this item on the
|
---|
442 | screen. This is usually the item's closest older sibling, but it
|
---|
443 | may also be its parent or its next older sibling's youngest child,
|
---|
444 | or something else if anyoftheabove->height() returns 0. Returns 0
|
---|
445 | if there is no item immediately above this item.
|
---|
446 | <p> This function assumes that all parents of this item are open (i.e.
|
---|
447 | that this item is visible, or can be made visible by scrolling).
|
---|
448 | <p> This function might be relatively slow because of the tree
|
---|
449 | traversions needed to find the correct item.
|
---|
450 | <p> <p>See also <a href="#itemBelow">itemBelow</a>() and <a href="qlistview.html#itemRect">QListView::itemRect</a>().
|
---|
451 |
|
---|
452 | <h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="itemBelow"></a>QListViewItem::itemBelow ()
|
---|
453 | </h3>
|
---|
454 | Returns a pointer to the item immediately below this item on the
|
---|
455 | screen. This is usually the item's eldest child, but it may also
|
---|
456 | be its next younger sibling, its parent's next younger sibling,
|
---|
457 | grandparent's, etc., or something else if anyoftheabove->height()
|
---|
458 | returns 0. Returns 0 if there is no item immediately below this
|
---|
459 | item.
|
---|
460 | <p> This function assumes that all parents of this item are open (i.e.
|
---|
461 | that this item is visible or can be made visible by scrolling).
|
---|
462 | <p> <p>See also <a href="#itemAbove">itemAbove</a>() and <a href="qlistview.html#itemRect">QListView::itemRect</a>().
|
---|
463 |
|
---|
464 | <p>Example: <a href="dirview-example.html#x1687">dirview/dirview.cpp</a>.
|
---|
465 | <h3 class=fn>int <a name="itemPos"></a>QListViewItem::itemPos () const
|
---|
466 | </h3>
|
---|
467 | Returns the y coordinate of this item in the list view's
|
---|
468 | coordinate system. This function is normally much slower than
|
---|
469 | <a href="qlistview.html#itemAt">QListView::itemAt</a>(), but it works for all items whereas
|
---|
470 | QListView::itemAt() normally only works for items on the screen.
|
---|
471 | <p> <p>See also <a href="qlistview.html#itemAt">QListView::itemAt</a>(), <a href="qlistview.html#itemRect">QListView::itemRect</a>(), and <a href="qlistview.html#itemPos">QListView::itemPos</a>().
|
---|
472 |
|
---|
473 | <h3 class=fn><a href="qstring.html">QString</a> <a name="key"></a>QListViewItem::key ( int column, bool ascending ) const<tt> [virtual]</tt>
|
---|
474 | </h3>
|
---|
475 |
|
---|
476 | <p> Returns a key that can be used for sorting by column <em>column</em>.
|
---|
477 | The default implementation returns <a href="#text">text</a>(). Derived classes may
|
---|
478 | also incorporate the order indicated by <em>ascending</em> into this
|
---|
479 | key, although this is not recommended.
|
---|
480 | <p> If you want to sort on non-alphabetical data, e.g. dates, numbers,
|
---|
481 | etc., it is more efficient to reimplement <a href="#compare">compare</a>().
|
---|
482 | <p> <p>See also <a href="#compare">compare</a>() and <a href="#sortChildItems">sortChildItems</a>().
|
---|
483 |
|
---|
484 | <h3 class=fn><a href="qlistview.html">QListView</a> * <a name="listView"></a>QListViewItem::listView () const
|
---|
485 | </h3>
|
---|
486 | Returns a pointer to the list view containing this item.
|
---|
487 | <p> Note that this function traverses the items to the root to find the
|
---|
488 | listview. This function will return 0 for taken items - see
|
---|
489 | <a href="#takeItem">QListViewItem::takeItem</a>()
|
---|
490 |
|
---|
491 | <h3 class=fn>void <a name="moveItem"></a>QListViewItem::moveItem ( <a href="qlistviewitem.html">QListViewItem</a> * after )
|
---|
492 | </h3>
|
---|
493 | Move the item to be after item <em>after</em>, which must be one of the
|
---|
494 | item's siblings. To move an item in the hierarchy, use <a href="#takeItem">takeItem</a>()
|
---|
495 | and <a href="#insertItem">insertItem</a>().
|
---|
496 | <p> Note that this function will have no effect if sorting is enabled
|
---|
497 | in the list view.
|
---|
498 |
|
---|
499 | <h3 class=fn>bool <a name="multiLinesEnabled"></a>QListViewItem::multiLinesEnabled () const
|
---|
500 | </h3>
|
---|
501 | Returns TRUE if the item can display multiple lines of text in its
|
---|
502 | columns; otherwise returns FALSE.
|
---|
503 |
|
---|
504 | <h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="nextSibling"></a>QListViewItem::nextSibling () const
|
---|
505 | </h3>
|
---|
506 |
|
---|
507 | <p> Returns the sibling item below this item, or 0 if there is no
|
---|
508 | sibling item after this item.
|
---|
509 | <p> Note that the siblings are not guaranteed to be sorted properly.
|
---|
510 | <a href="qlistview.html">QListView</a> and QListViewItem try to postpone or avoid sorting to
|
---|
511 | the greatest degree possible, in order to keep the user interface
|
---|
512 | snappy.
|
---|
513 | <p> <p>See also <a href="#firstChild">firstChild</a>() and <a href="#sortChildItems">sortChildItems</a>().
|
---|
514 |
|
---|
515 | <p>Example: <a href="tagreader-with-features-example.html#x1965">xml/tagreader-with-features/structureparser.cpp</a>.
|
---|
516 | <h3 class=fn>void <a name="okRename"></a>QListViewItem::okRename ( int col )<tt> [virtual protected]</tt>
|
---|
517 | </h3>
|
---|
518 | This function is called if the user presses Enter during in-place
|
---|
519 | renaming of the item in column <em>col</em>.
|
---|
520 | <p> <p>See also <a href="#cancelRename">cancelRename</a>().
|
---|
521 |
|
---|
522 | <h3 class=fn>void <a name="paintBranches"></a>QListViewItem::paintBranches ( <a href="qpainter.html">QPainter</a> * p, const <a href="qcolorgroup.html">QColorGroup</a> & cg, int w, int y, int h )<tt> [virtual]</tt>
|
---|
523 | </h3>
|
---|
524 | Paints a set of branches from this item to (some of) its children.
|
---|
525 | <p> Painter <em>p</em> is set up with clipping and translation so that you
|
---|
526 | can only draw in the rectangle that needs redrawing; <em>cg</em> is the
|
---|
527 | color group to use; the update rectangle is at (0, 0) and has size
|
---|
528 | width <em>w</em> by height <em>h</em>. The top of the rectangle you own is at
|
---|
529 | <em>y</em> (which is never greater than 0 but can be outside the window
|
---|
530 | system's allowed coordinate range).
|
---|
531 | <p> The update rectangle is in an undefined state when this function
|
---|
532 | is called; this function must draw on <em>all</em> of the pixels.
|
---|
533 | <p> <p>See also <a href="#paintCell">paintCell</a>() and <a href="qlistview.html#drawContentsOffset">QListView::drawContentsOffset</a>().
|
---|
534 |
|
---|
535 | <h3 class=fn>void <a name="paintCell"></a>QListViewItem::paintCell ( <a href="qpainter.html">QPainter</a> * p, const <a href="qcolorgroup.html">QColorGroup</a> & cg, int column, int width, int align )<tt> [virtual]</tt>
|
---|
536 | </h3>
|
---|
537 | This virtual function paints the contents of one column of an item
|
---|
538 | and aligns it as described by <em>align</em>.
|
---|
539 | <p> <em>p</em> is a <a href="qpainter.html">QPainter</a> open on the relevant paint device. <em>p</em> is
|
---|
540 | 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
|
---|
541 | other properties of <em>p</em> (pen, brush, etc) are undefined. <em>cg</em> is
|
---|
542 | the color group to use. <em>column</em> is the logical column number
|
---|
543 | within the item that is to be painted; 0 is the column which may
|
---|
544 | contain a tree.
|
---|
545 | <p> This function may use <a href="qlistview.html#itemMargin">QListView::itemMargin</a>() for readability
|
---|
546 | spacing on the left and right sides of data such as text, and
|
---|
547 | should honor <a href="#isSelected">isSelected</a>() and <a href="qlistview.html#allColumnsShowFocus">QListView::allColumnsShowFocus</a>().
|
---|
548 | <p> If you reimplement this function, you should also reimplement
|
---|
549 | <a href="#width">width</a>().
|
---|
550 | <p> The rectangle to be painted is in an undefined state when this
|
---|
551 | function is called, so you <em>must</em> draw on all the pixels. The
|
---|
552 | painter <em>p</em> has the right font on entry.
|
---|
553 | <p> <p>See also <a href="#paintBranches">paintBranches</a>() and <a href="qlistview.html#drawContentsOffset">QListView::drawContentsOffset</a>().
|
---|
554 |
|
---|
555 | <p>Example: <a href="listviews-example.html#x157">listviews/listviews.cpp</a>.
|
---|
556 | <p>Reimplemented in <a href="qchecklistitem.html#paintCell">QCheckListItem</a>.
|
---|
557 | <h3 class=fn>void <a name="paintFocus"></a>QListViewItem::paintFocus ( <a href="qpainter.html">QPainter</a> * p, const <a href="qcolorgroup.html">QColorGroup</a> & cg, const <a href="qrect.html">QRect</a> & r )<tt> [virtual]</tt>
|
---|
558 | </h3>
|
---|
559 | Paints a focus indicator on the rectangle <em>r</em> using painter <em>p</em>
|
---|
560 | and colors <em>cg</em>.
|
---|
561 | <p> <em>p</em> is already clipped.
|
---|
562 | <p> <p>See also <a href="#paintCell">paintCell</a>(), <a href="#paintBranches">paintBranches</a>(), and <a href="qlistview.html#allColumnsShowFocus-prop">QListView::allColumnsShowFocus</a>.
|
---|
563 |
|
---|
564 | <p>Reimplemented in <a href="qchecklistitem.html#paintFocus">QCheckListItem</a>.
|
---|
565 | <h3 class=fn><a href="qlistviewitem.html">QListViewItem</a> * <a name="parent"></a>QListViewItem::parent () const
|
---|
566 | </h3>
|
---|
567 | Returns the parent of this item, or 0 if this item has no parent.
|
---|
568 | <p> <p>See also <a href="#firstChild">firstChild</a>() and <a href="#nextSibling">nextSibling</a>().
|
---|
569 |
|
---|
570 | <p>Examples: <a href="dirview-example.html#x1688">dirview/dirview.cpp</a> and <a href="qaxcontainer-example-qutlook.html#x2727">qutlook/centralwidget.cpp</a>.
|
---|
571 | <h3 class=fn>const <a href="qpixmap.html">QPixmap</a> * <a name="pixmap"></a>QListViewItem::pixmap ( int column ) const<tt> [virtual]</tt>
|
---|
572 | </h3>
|
---|
573 | Returns the pixmap for <em>column</em>, or 0 if there is no pixmap for
|
---|
574 | <em>column</em>.
|
---|
575 | <p> <p>See also <a href="#setText">setText</a>() and <a href="#setPixmap">setPixmap</a>().
|
---|
576 |
|
---|
577 | <p>Example: <a href="dirview-example.html#x1689">dirview/dirview.cpp</a>.
|
---|
578 | <h3 class=fn>void <a name="removeItem"></a>QListViewItem::removeItem ( <a href="qlistviewitem.html">QListViewItem</a> * item )<tt> [virtual]</tt>
|
---|
579 | </h3>
|
---|
580 |
|
---|
581 | <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
---|
582 | <p> This function has been renamed <a href="#takeItem">takeItem</a>().
|
---|
583 |
|
---|
584 | <h3 class=fn>bool <a name="renameEnabled"></a>QListViewItem::renameEnabled ( int col ) const
|
---|
585 | </h3>
|
---|
586 | Returns TRUE if this item can be in-place renamed in column <em>col</em>; otherwise returns FALSE.
|
---|
587 |
|
---|
588 | <h3 class=fn>void <a name="repaint"></a>QListViewItem::repaint () const
|
---|
589 | </h3>
|
---|
590 | Repaints this item on the screen if it is currently visible.
|
---|
591 |
|
---|
592 | <p>Example: <a href="addressbook-example.html#x593">addressbook/centralwidget.cpp</a>.
|
---|
593 | <h3 class=fn>int <a name="rtti"></a>QListViewItem::rtti () const<tt> [virtual]</tt>
|
---|
594 | </h3>
|
---|
595 | Returns 0.
|
---|
596 | <p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), so
|
---|
597 | that you can distinguish between different kinds of list view
|
---|
598 | items. You should use values greater than 1000 to allow for
|
---|
599 | extensions to this class.
|
---|
600 |
|
---|
601 | <p>Reimplemented in <a href="qchecklistitem.html#rtti">QCheckListItem</a>.
|
---|
602 | <h3 class=fn>void <a name="setDragEnabled"></a>QListViewItem::setDragEnabled ( bool allow )<tt> [virtual]</tt>
|
---|
603 | </h3>
|
---|
604 | If <em>allow</em> is TRUE, the list view starts a drag (see
|
---|
605 | <a href="qlistview.html#dragObject">QListView::dragObject</a>()) when the user presses and moves the mouse
|
---|
606 | on this item.
|
---|
607 |
|
---|
608 | <h3 class=fn>void <a name="setDropEnabled"></a>QListViewItem::setDropEnabled ( bool allow )<tt> [virtual]</tt>
|
---|
609 | </h3>
|
---|
610 | If <em>allow</em> is TRUE, the list view accepts drops onto the item;
|
---|
611 | otherwise drops are not allowed.
|
---|
612 |
|
---|
613 | <h3 class=fn>void <a name="setEnabled"></a>QListViewItem::setEnabled ( bool b )<tt> [virtual]</tt>
|
---|
614 | </h3>
|
---|
615 | If <em>b</em> is TRUE the item is enabled; otherwise it is disabled.
|
---|
616 | Disabled items are drawn differently (e.g. grayed-out) and are not
|
---|
617 | accessible by the user.
|
---|
618 |
|
---|
619 | <h3 class=fn>void <a name="setExpandable"></a>QListViewItem::setExpandable ( bool enable )<tt> [virtual]</tt>
|
---|
620 | </h3>
|
---|
621 | 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).
|
---|
622 | <p> The dirview example uses this in the canonical fashion. It checks
|
---|
623 | whether the directory is empty in <a href="#setup">setup</a>() and calls
|
---|
624 | <a href="#setExpandable">setExpandable</a>(TRUE) if not; in <a href="#setOpen">setOpen</a>() it reads the contents of
|
---|
625 | the directory and inserts items accordingly. This strategy means
|
---|
626 | that dirview can display the entire file system without reading
|
---|
627 | very much at startup.
|
---|
628 | <p> Note that root items are not expandable by the user unless
|
---|
629 | <a href="qlistview.html#setRootIsDecorated">QListView::setRootIsDecorated</a>() is set to TRUE.
|
---|
630 | <p> <p>See also <a href="#setSelectable">setSelectable</a>().
|
---|
631 |
|
---|
632 | <h3 class=fn>void <a name="setHeight"></a>QListViewItem::setHeight ( int height )<tt> [virtual protected]</tt>
|
---|
633 | </h3>
|
---|
634 | Sets this item's height to <em>height</em> pixels. This implicitly
|
---|
635 | changes <a href="#totalHeight">totalHeight</a>(), too.
|
---|
636 | <p> Note that a font change causes this height to be overwritten
|
---|
637 | unless you reimplement <a href="#setup">setup</a>().
|
---|
638 | <p> For best results in Windows style we suggest using an even number
|
---|
639 | of pixels.
|
---|
640 | <p> <p>See also <a href="#height">height</a>(), <a href="#totalHeight">totalHeight</a>(), and <a href="#isOpen">isOpen</a>().
|
---|
641 |
|
---|
642 | <h3 class=fn>void <a name="setMultiLinesEnabled"></a>QListViewItem::setMultiLinesEnabled ( bool b )<tt> [virtual]</tt>
|
---|
643 | </h3>
|
---|
644 | If <em>b</em> is TRUE each of the item's columns may contain multiple
|
---|
645 | lines of text; otherwise each of them may only contain a single
|
---|
646 | line.
|
---|
647 |
|
---|
648 | <h3 class=fn>void <a name="setOpen"></a>QListViewItem::setOpen ( bool o )<tt> [virtual]</tt>
|
---|
649 | </h3>
|
---|
650 | Opens or closes an item, i.e. shows or hides an item's children.
|
---|
651 | <p> If <em>o</em> is TRUE all child items are shown initially. The user can
|
---|
652 | hide them by clicking the <b>-</b> icon to the left of the item.
|
---|
653 | If <em>o</em> is FALSE, the children of this item are initially hidden.
|
---|
654 | The user can show them by clicking the <b>+</b> icon to the left
|
---|
655 | of the item.
|
---|
656 | <p> <p>See also <a href="#height">height</a>(), <a href="#totalHeight">totalHeight</a>(), and <a href="#isOpen">isOpen</a>().
|
---|
657 |
|
---|
658 | <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>.
|
---|
659 | <h3 class=fn>void <a name="setPixmap"></a>QListViewItem::setPixmap ( int column, const <a href="qpixmap.html">QPixmap</a> & pm )<tt> [virtual]</tt>
|
---|
660 | </h3>
|
---|
661 | Sets the pixmap in column <em>column</em> to <em>pm</em>, if <em>pm</em> is non-null
|
---|
662 | and different from the current pixmap, and if <em>column</em> is
|
---|
663 | non-negative.
|
---|
664 | <p> <p>See also <a href="#pixmap">pixmap</a>() and <a href="#setText">setText</a>().
|
---|
665 |
|
---|
666 | <p>Example: <a href="dirview-example.html#x1691">dirview/dirview.cpp</a>.
|
---|
667 | <h3 class=fn>void <a name="setRenameEnabled"></a>QListViewItem::setRenameEnabled ( int col, bool b )<tt> [virtual]</tt>
|
---|
668 | </h3>
|
---|
669 | If <em>b</em> is TRUE, this item can be in-place renamed in the column
|
---|
670 | <em>col</em> by the user; otherwise it cannot be renamed in-place.
|
---|
671 |
|
---|
672 | <h3 class=fn>void <a name="setSelectable"></a>QListViewItem::setSelectable ( bool enable )<tt> [virtual]</tt>
|
---|
673 | </h3>
|
---|
674 | Sets this item to be selectable if <em>enable</em> is TRUE (the
|
---|
675 | default) or not to be selectable if <em>enable</em> is FALSE.
|
---|
676 | <p> The user is not able to select a non-selectable item using either
|
---|
677 | the keyboard or the mouse. This also applies for the application
|
---|
678 | programmer (e.g. <a href="#setSelected">setSelected</a>() respects this value).
|
---|
679 | <p> <p>See also <a href="#isSelectable">isSelectable</a>().
|
---|
680 |
|
---|
681 | <h3 class=fn>void <a name="setSelected"></a>QListViewItem::setSelected ( bool s )<tt> [virtual]</tt>
|
---|
682 | </h3>
|
---|
683 | If <em>s</em> is TRUE this item is selected; otherwise it is deselected.
|
---|
684 | <p> This function does not maintain any invariants or repaint anything
|
---|
685 | -- <a href="qlistview.html#setSelected">QListView::setSelected</a>() does that.
|
---|
686 | <p> <p>See also <a href="#height">height</a>() and <a href="#totalHeight">totalHeight</a>().
|
---|
687 |
|
---|
688 | <p>Example: <a href="addressbook-example.html#x594">addressbook/centralwidget.cpp</a>.
|
---|
689 | <h3 class=fn>void <a name="setText"></a>QListViewItem::setText ( int column, const <a href="qstring.html">QString</a> & text )<tt> [virtual]</tt>
|
---|
690 | </h3>
|
---|
691 | Sets the text in column <em>column</em> to <em>text</em>, if <em>column</em> is a
|
---|
692 | valid column number and <em>text</em> is different from the existing
|
---|
693 | text.
|
---|
694 | <p> If <em>text()</em> has been reimplemented, this function may be a no-op.
|
---|
695 | <p> <p>See also <a href="#text">text</a>() and <a href="#key">key</a>().
|
---|
696 |
|
---|
697 | <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>.
|
---|
698 | <h3 class=fn>void <a name="setVisible"></a>QListViewItem::setVisible ( bool b )
|
---|
699 | </h3>
|
---|
700 | If <em>b</em> is TRUE, the item is made visible; otherwise it is hidden.
|
---|
701 | <p> If the item is not visible, <a href="#itemAbove">itemAbove</a>() and <a href="#itemBelow">itemBelow</a>() will never
|
---|
702 | return this item, although you still can reach it by using e.g.
|
---|
703 | <a href="qlistviewitemiterator.html">QListViewItemIterator</a>.
|
---|
704 |
|
---|
705 | <h3 class=fn>void <a name="setup"></a>QListViewItem::setup ()<tt> [virtual]</tt>
|
---|
706 | </h3>
|
---|
707 | This virtual function is called before the first time <a href="qlistview.html">QListView</a>
|
---|
708 | needs to know the height or any other graphical attribute of this
|
---|
709 | object, and whenever the font, GUI style, or colors of the list
|
---|
710 | view change.
|
---|
711 | <p> The default calls <a href="#widthChanged">widthChanged</a>() and sets the item's height to the
|
---|
712 | height of a single line of text in the list view's font. (If you
|
---|
713 | use icons, multi-line text, etc., you will probably need to call
|
---|
714 | <a href="#setHeight">setHeight</a>() yourself or reimplement it.)
|
---|
715 |
|
---|
716 | <p>Example: <a href="dirview-example.html#x1692">dirview/dirview.cpp</a>.
|
---|
717 | <h3 class=fn>void <a name="sort"></a>QListViewItem::sort ()<tt> [virtual]</tt>
|
---|
718 | </h3>
|
---|
719 | Sorts all this item's child items using the current sorting
|
---|
720 | configuration (sort column and direction).
|
---|
721 | <p> <p>See also <a href="#enforceSortOrder">enforceSortOrder</a>().
|
---|
722 |
|
---|
723 | <h3 class=fn>void <a name="sortChildItems"></a>QListViewItem::sortChildItems ( int column, bool ascending )<tt> [virtual]</tt>
|
---|
724 | </h3>
|
---|
725 | Sorts this item's children using column <em>column</em>. This is done in
|
---|
726 | ascending order if <em>ascending</em> is TRUE and in descending order if
|
---|
727 | <em>ascending</em> is FALSE.
|
---|
728 | <p> Asks some of the children to sort their children. (<a href="qlistview.html">QListView</a> and
|
---|
729 | QListViewItem ensure that all on-screen objects are properly
|
---|
730 | sorted but may avoid or defer sorting other objects in order to be
|
---|
731 | more responsive.)
|
---|
732 | <p> <p>See also <a href="#key">key</a>() and <a href="#compare">compare</a>().
|
---|
733 |
|
---|
734 | <h3 class=fn>void <a name="startRename"></a>QListViewItem::startRename ( int col )<tt> [virtual]</tt>
|
---|
735 | </h3>
|
---|
736 | If in-place renaming of this item is enabled (see
|
---|
737 | <a href="#renameEnabled">renameEnabled</a>()), this function starts renaming the item in column
|
---|
738 | <em>col</em>, by creating and initializing an edit box.
|
---|
739 |
|
---|
740 | <h3 class=fn>void <a name="takeItem"></a>QListViewItem::takeItem ( <a href="qlistviewitem.html">QListViewItem</a> * item )<tt> [virtual]</tt>
|
---|
741 | </h3>
|
---|
742 | Removes <em>item</em> from this object's list of children and causes an
|
---|
743 | update of the screen display. The item is not deleted. You should
|
---|
744 | not normally need to call this function because
|
---|
745 | <a href="#~QListViewItem">QListViewItem::~QListViewItem</a>() calls it.
|
---|
746 | <p> The normal way to delete an item is to use <tt>delete</tt>.
|
---|
747 | <p> If you need to move an item from one place in the hierarchy to
|
---|
748 | another you can use <a href="#takeItem">takeItem</a>() to remove the item from the list
|
---|
749 | view and then <a href="#insertItem">insertItem</a>() to put the item back in its new
|
---|
750 | position.
|
---|
751 | <p> If a taken item is part of a selection in <tt>Single</tt> selection
|
---|
752 | mode, it is unselected and selectionChanged() is emitted. If a
|
---|
753 | taken item is part of a selection in <tt>Multi</tt> or <tt>Extended</tt>
|
---|
754 | selection mode, it remains selected.
|
---|
755 | <p> <b>Warning:</b> This function leaves <em>item</em> and its children in a state
|
---|
756 | where most member functions are unsafe. Only a few functions work
|
---|
757 | correctly on an item in this state, most notably insertItem(). The
|
---|
758 | functions that work on taken items are explicitly documented as
|
---|
759 | such.
|
---|
760 | <p> <p>See also <a href="#insertItem">QListViewItem::insertItem</a>().
|
---|
761 |
|
---|
762 | <h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QListViewItem::text ( int column ) const<tt> [virtual]</tt>
|
---|
763 | </h3>
|
---|
764 | Returns the text in column <em>column</em>, or <a href="qstring.html#QString-null">QString::null</a> if there is
|
---|
765 | no text in that column.
|
---|
766 | <p> <p>See also <a href="#key">key</a>() and <a href="#paintCell">paintCell</a>().
|
---|
767 |
|
---|
768 | <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>.
|
---|
769 | <h3 class=fn>int <a name="totalHeight"></a>QListViewItem::totalHeight () const
|
---|
770 | </h3>
|
---|
771 | Returns the total height of this object, including any visible
|
---|
772 | children. This height is recomputed lazily and cached for as long
|
---|
773 | as possible.
|
---|
774 | <p> Functions which can affect the total height are, <a href="#setHeight">setHeight</a>() which
|
---|
775 | is used to set an item's height, <a href="#setOpen">setOpen</a>() to show or hide an
|
---|
776 | item's children, and <a href="#invalidateHeight">invalidateHeight</a>() to invalidate the cached
|
---|
777 | height.
|
---|
778 | <p> <p>See also <a href="#height">height</a>().
|
---|
779 |
|
---|
780 | <h3 class=fn>int <a name="width"></a>QListViewItem::width ( const <a href="qfontmetrics.html">QFontMetrics</a> & fm, const <a href="qlistview.html">QListView</a> * lv, int c ) const<tt> [virtual]</tt>
|
---|
781 | </h3>
|
---|
782 | Returns the number of pixels of width required to draw column <em>c</em>
|
---|
783 | of list view <em>lv</em>, using the metrics <em>fm</em> without cropping. The
|
---|
784 | list view containing this item may use this information depending
|
---|
785 | on the QListView::WidthMode settings for the column.
|
---|
786 | <p> The default implementation returns the width of the bounding
|
---|
787 | rectangle of the text of column <em>c</em>.
|
---|
788 | <p> <p>See also <a href="#listView">listView</a>(), <a href="#widthChanged">widthChanged</a>(), <a href="qlistview.html#setColumnWidthMode">QListView::setColumnWidthMode</a>(), and <a href="qlistview.html#itemMargin-prop">QListView::itemMargin</a>.
|
---|
789 |
|
---|
790 | <h3 class=fn>void <a name="widthChanged"></a>QListViewItem::widthChanged ( int c = -1 ) const
|
---|
791 | </h3>
|
---|
792 | Call this function when the value of <a href="#width">width</a>() may have changed for
|
---|
793 | column <em>c</em>. Normally, you should call this if <a href="#text">text</a>(c) changes.
|
---|
794 | Passing -1 for <em>c</em> indicates that all columns may have changed.
|
---|
795 | It is more efficient to pass -1 if two or more columns have
|
---|
796 | changed than to call <a href="#widthChanged">widthChanged</a>() separately for each one.
|
---|
797 | <p> <p>See also <a href="#width">width</a>().
|
---|
798 |
|
---|
799 | <!-- eof -->
|
---|
800 | <hr><p>
|
---|
801 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
802 | Copyright © 1995-2007
|
---|
803 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
804 | <table width=100% cellspacing=0 border=0><tr>
|
---|
805 | <td>Copyright © 2007
|
---|
806 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
807 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
808 | </table></div></address></body>
|
---|
809 | </html>
|
---|