source: trunk/doc/html/qiconviewitem.html@ 208

Last change on this file since 208 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 38.8 KB
Line 
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/iconview/qiconview.cpp:800 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QIconViewItem Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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>QIconViewItem Class Reference<br><small>[<a href="iconview.html">iconview module</a>]</small></h1>
33
34<p>The QIconViewItem class provides a single item in a QIconView.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qiconview-h.html">qiconview.h</a>&gt;</tt>
37<p>Inherits <a href="qt.html">Qt</a>.
38<p><a href="qiconviewitem-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QIconViewItem"><b>QIconViewItem</b></a> ( QIconView&nbsp;*&nbsp;parent )</li>
42<li class=fn><a href="#QIconViewItem-2"><b>QIconViewItem</b></a> ( QIconView&nbsp;*&nbsp;parent, QIconViewItem&nbsp;*&nbsp;after )</li>
43<li class=fn><a href="#QIconViewItem-3"><b>QIconViewItem</b></a> ( QIconView&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;text )</li>
44<li class=fn><a href="#QIconViewItem-4"><b>QIconViewItem</b></a> ( QIconView&nbsp;*&nbsp;parent, QIconViewItem&nbsp;*&nbsp;after, const&nbsp;QString&nbsp;&amp;&nbsp;text )</li>
45<li class=fn><a href="#QIconViewItem-5"><b>QIconViewItem</b></a> ( QIconView&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QPixmap&nbsp;&amp;&nbsp;icon )</li>
46<li class=fn><a href="#QIconViewItem-6"><b>QIconViewItem</b></a> ( QIconView&nbsp;*&nbsp;parent, QIconViewItem&nbsp;*&nbsp;after, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QPixmap&nbsp;&amp;&nbsp;icon )</li>
47<li class=fn><a href="#QIconViewItem-7"><b>QIconViewItem</b></a> ( QIconView&nbsp;*&nbsp;parent, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QPicture&nbsp;&amp;&nbsp;picture )</li>
48<li class=fn><a href="#QIconViewItem-8"><b>QIconViewItem</b></a> ( QIconView&nbsp;*&nbsp;parent, QIconViewItem&nbsp;*&nbsp;after, const&nbsp;QString&nbsp;&amp;&nbsp;text, const&nbsp;QPicture&nbsp;&amp;&nbsp;picture )</li>
49<li class=fn>virtual <a href="#~QIconViewItem"><b>~QIconViewItem</b></a> ()</li>
50<li class=fn>virtual void <a href="#setRenameEnabled"><b>setRenameEnabled</b></a> ( bool&nbsp;allow )</li>
51<li class=fn>virtual void <a href="#setDragEnabled"><b>setDragEnabled</b></a> ( bool&nbsp;allow )</li>
52<li class=fn>virtual void <a href="#setDropEnabled"><b>setDropEnabled</b></a> ( bool&nbsp;allow )</li>
53<li class=fn>virtual QString <a href="#text"><b>text</b></a> () const</li>
54<li class=fn>virtual QPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li>
55<li class=fn>virtual QPicture * <a href="#picture"><b>picture</b></a> () const</li>
56<li class=fn>virtual QString <a href="#key"><b>key</b></a> () const</li>
57<li class=fn>bool <a href="#renameEnabled"><b>renameEnabled</b></a> () const</li>
58<li class=fn>bool <a href="#dragEnabled"><b>dragEnabled</b></a> () const</li>
59<li class=fn>bool <a href="#dropEnabled"><b>dropEnabled</b></a> () const</li>
60<li class=fn>QIconView * <a href="#iconView"><b>iconView</b></a> () const</li>
61<li class=fn>QIconViewItem * <a href="#prevItem"><b>prevItem</b></a> () const</li>
62<li class=fn>QIconViewItem * <a href="#nextItem"><b>nextItem</b></a> () const</li>
63<li class=fn>int <a href="#index"><b>index</b></a> () const</li>
64<li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( bool&nbsp;s, bool&nbsp;cb )</li>
65<li class=fn>virtual void <a href="#setSelected-2"><b>setSelected</b></a> ( bool&nbsp;s )</li>
66<li class=fn>virtual void <a href="#setSelectable"><b>setSelectable</b></a> ( bool&nbsp;enable )</li>
67<li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> () const</li>
68<li class=fn>bool <a href="#isSelectable"><b>isSelectable</b></a> () const</li>
69<li class=fn>virtual void <a href="#repaint"><b>repaint</b></a> ()</li>
70<li class=fn>virtual bool <a href="#move"><b>move</b></a> ( int&nbsp;x, int&nbsp;y )</li>
71<li class=fn>virtual void <a href="#moveBy"><b>moveBy</b></a> ( int&nbsp;dx, int&nbsp;dy )</li>
72<li class=fn>virtual bool <a href="#move-2"><b>move</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pnt )</li>
73<li class=fn>virtual void <a href="#moveBy-2"><b>moveBy</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pnt )</li>
74<li class=fn>QRect <a href="#rect"><b>rect</b></a> () const</li>
75<li class=fn>int <a href="#x"><b>x</b></a> () const</li>
76<li class=fn>int <a href="#y"><b>y</b></a> () const</li>
77<li class=fn>int <a href="#width"><b>width</b></a> () const</li>
78<li class=fn>int <a href="#height"><b>height</b></a> () const</li>
79<li class=fn>QSize <a href="#size"><b>size</b></a> () const</li>
80<li class=fn>QPoint <a href="#pos"><b>pos</b></a> () const</li>
81<li class=fn>QRect <a href="#textRect"><b>textRect</b></a> ( bool&nbsp;relative = TRUE ) const</li>
82<li class=fn>QRect <a href="#pixmapRect"><b>pixmapRect</b></a> ( bool&nbsp;relative = TRUE ) const</li>
83<li class=fn>bool <a href="#contains"><b>contains</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;pnt ) const</li>
84<li class=fn>bool <a href="#intersects"><b>intersects</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r ) const</li>
85<li class=fn>virtual bool <a href="#acceptDrop"><b>acceptDrop</b></a> ( const&nbsp;QMimeSource&nbsp;*&nbsp;mime ) const</li>
86<li class=fn>void <a href="#rename"><b>rename</b></a> ()</li>
87<li class=fn>virtual int <a href="#compare"><b>compare</b></a> ( QIconViewItem&nbsp;*&nbsp;i ) const</li>
88<li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text )</li>
89<li class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;icon )</li>
90<li class=fn>virtual void <a href="#setPicture"><b>setPicture</b></a> ( const&nbsp;QPicture&nbsp;&amp;&nbsp;icon )</li>
91<li class=fn>virtual void <a href="#setText-2"><b>setText</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text, bool&nbsp;recalc, bool&nbsp;redraw = TRUE )</li>
92<li class=fn>virtual void <a href="#setPixmap-2"><b>setPixmap</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;icon, bool&nbsp;recalc, bool&nbsp;redraw = TRUE )</li>
93<li class=fn>virtual void <a href="#setKey"><b>setKey</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;k )</li>
94<li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li>
95</ul>
96<h2>Protected Members</h2>
97<ul>
98<li class=fn>virtual void <a href="#removeRenameBox"><b>removeRenameBox</b></a> ()</li>
99<li class=fn>virtual void <a href="#calcRect"><b>calcRect</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;text_ = QString::null )</li>
100<li class=fn>virtual void <a href="#paintItem"><b>paintItem</b></a> ( QPainter&nbsp;*&nbsp;p, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;cg )</li>
101<li class=fn>virtual void <a href="#paintFocus"><b>paintFocus</b></a> ( QPainter&nbsp;*&nbsp;p, const&nbsp;QColorGroup&nbsp;&amp;&nbsp;cg )</li>
102<li class=fn>virtual void <a href="#dropped"><b>dropped</b></a> ( QDropEvent&nbsp;*&nbsp;e, const&nbsp;QValueList&lt;QIconDragItem&gt;&nbsp;&amp;&nbsp;lst )</li>
103<li class=fn>virtual void <a href="#dragEntered"><b>dragEntered</b></a> ()</li>
104<li class=fn>virtual void <a href="#dragLeft"><b>dragLeft</b></a> ()</li>
105<li class=fn>void <a href="#setItemRect"><b>setItemRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
106<li class=fn>void <a href="#setTextRect"><b>setTextRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
107<li class=fn>void <a href="#setPixmapRect"><b>setPixmapRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;r )</li>
108</ul>
109<hr><a name="details"></a><h2>Detailed Description</h2>
110
111
112The QIconViewItem class provides a single item in a <a href="qiconview.html">QIconView</a>.
113<p>
114
115<p> A QIconViewItem contains an icon, a string and optionally a sort
116key, and can display itself in a QIconView.
117The class is designed to be very similar to <a href="qlistview.html">QListView</a> and <a href="qlistbox.html">QListBox</a>
118in use, both via instantiation and subclassing.
119<p> The simplest way to create a QIconViewItem and insert it into a
120QIconView is to construct the item passing the constructor a
121pointer to the icon view, a string and an icon:
122<p> <pre>
123 (void) new QIconViewItem(
124 iconView, // A pointer to a QIconView
125 "This is the text of the item",
126 aPixmap );
127 </pre>
128
129<p> By default the text of an icon view item may not be edited by the
130user but calling <a href="#setRenameEnabled">setRenameEnabled</a>(TRUE) will allow the user to
131perform in-place editing of the item's text.
132<p> When the icon view is deleted all items in it are deleted
133automatically.
134<p> The <a href="qiconview.html#firstItem">QIconView::firstItem</a>() and <a href="#nextItem">QIconViewItem::nextItem</a>() functions
135provide a means of iterating over all the items in a QIconView:
136<p> <pre>
137 QIconViewItem *item;
138 for ( item = iconView-&gt;firstItem(); item; item = item-&gt;<a href="#nextItem">nextItem</a>() )
139 do_something_with( item );
140 </pre>
141
142<p> The item's icon view is available from <a href="#iconView">iconView</a>(), and its
143position in the icon view from <a href="#index">index</a>().
144<p> The item's selection status is available from <a href="#isSelected">isSelected</a>() and is
145set and controlled by <a href="#setSelected">setSelected</a>() and <a href="#isSelectable">isSelectable</a>().
146<p> The text and icon can be set with <a href="#setText">setText</a>() and <a href="#setPixmap">setPixmap</a>() and
147retrieved with <a href="#text">text</a>() and <a href="#pixmap">pixmap</a>(). The item's sort key defaults
148to text() but may be set with <a href="#setKey">setKey</a>() and retrieved with <a href="#key">key</a>().
149The comparison function, <a href="#compare">compare</a>() uses key().
150<p> Items may be repositioned with <a href="#move">move</a>() and <a href="#moveBy">moveBy</a>(). An item's
151geometry is available from <a href="#rect">rect</a>(), <a href="#x">x</a>(), <a href="#y">y</a>(), <a href="#width">width</a>(), <a href="#height">height</a>(),
152<a href="#size">size</a>(), <a href="#pos">pos</a>(), <a href="#textRect">textRect</a>() and <a href="#pixmapRect">pixmapRect</a>(). You can also test
153against the position of a point with <a href="#contains">contains</a>() and <a href="#intersects">intersects</a>().
154<p> To remove an item from an icon view, just delete the item. The
155QIconViewItem destructor removes it cleanly from its icon view.
156<p> Because the icon view is designed to use drag-and-drop, the icon
157view item also has functions for drag-and-drop which may be
158reimplemented.
159<p> <a name="pixmap-size-limit"></a>
160<b>Note:</b> Pixmaps with individual dimensions larger than 300 pixels may
161not be displayed properly, depending on the <a href="qiconview.html#Arrangement-enum">arrangement in use</a>. For example, pixmaps wider than 300 pixels
162will not be arranged correctly if the icon view uses a
163<a href="qiconview.html#Arrangement-enum">QIconView::TopToBottom</a> arrangement, and pixmaps taller than 300 pixels
164will not be arranged correctly if the icon view uses a
165<a href="qiconview.html#Arrangement-enum">QIconView::LeftToRight</a> arrangement.
166<p>See also <a href="advanced.html">Advanced Widgets</a>.
167
168<hr><h2>Member Function Documentation</h2>
169<h3 class=fn><a name="QIconViewItem"></a>QIconViewItem::QIconViewItem ( <a href="qiconview.html">QIconView</a>&nbsp;*&nbsp;parent )
170</h3>
171Constructs a QIconViewItem and inserts it into icon view <em>parent</em>
172with no text and a default icon.
173
174<h3 class=fn><a name="QIconViewItem-2"></a>QIconViewItem::QIconViewItem ( <a href="qiconview.html">QIconView</a>&nbsp;*&nbsp;parent, <a href="qiconviewitem.html">QIconViewItem</a>&nbsp;*&nbsp;after )
175</h3>
176Constructs a QIconViewItem and inserts it into the icon view <em>parent</em> with no text and a default icon, after the icon view item
177<em>after</em>.
178
179<h3 class=fn><a name="QIconViewItem-3"></a>QIconViewItem::QIconViewItem ( <a href="qiconview.html">QIconView</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )
180</h3>
181Constructs an icon view item and inserts it into the icon view <em>parent</em> using <em>text</em> as the text and a default icon.
182
183<h3 class=fn><a name="QIconViewItem-4"></a>QIconViewItem::QIconViewItem ( <a href="qiconview.html">QIconView</a>&nbsp;*&nbsp;parent, <a href="qiconviewitem.html">QIconViewItem</a>&nbsp;*&nbsp;after, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )
184</h3>
185Constructs an icon view item and inserts it into the icon view <em>parent</em> using <em>text</em> as the text and a default icon, after the
186icon view item <em>after</em>.
187
188<h3 class=fn><a name="QIconViewItem-5"></a>QIconViewItem::QIconViewItem ( <a href="qiconview.html">QIconView</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;icon )
189</h3>
190Constructs an icon view item and inserts it into the icon view <em>parent</em> using <em>text</em> as the text and <em>icon</em> as the icon.
191
192<h3 class=fn><a name="QIconViewItem-6"></a>QIconViewItem::QIconViewItem ( <a href="qiconview.html">QIconView</a>&nbsp;*&nbsp;parent, <a href="qiconviewitem.html">QIconViewItem</a>&nbsp;*&nbsp;after, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;icon )
193</h3>
194Constructs an icon view item and inserts it into the icon view <em>parent</em> using <em>text</em> as the text and <em>icon</em> as the icon, after
195the icon view item <em>after</em>.
196<p> <p>See also <a href="#setPixmap">setPixmap</a>().
197
198<h3 class=fn><a name="QIconViewItem-7"></a>QIconViewItem::QIconViewItem ( <a href="qiconview.html">QIconView</a>&nbsp;*&nbsp;parent, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qpicture.html">QPicture</a>&nbsp;&amp;&nbsp;picture )
199</h3>
200Constructs an icon view item and inserts it into the icon view <em>parent</em> using <em>text</em> as the text and <em>picture</em> as the icon.
201
202<h3 class=fn><a name="QIconViewItem-8"></a>QIconViewItem::QIconViewItem ( <a href="qiconview.html">QIconView</a>&nbsp;*&nbsp;parent, <a href="qiconviewitem.html">QIconViewItem</a>&nbsp;*&nbsp;after, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, const&nbsp;<a href="qpicture.html">QPicture</a>&nbsp;&amp;&nbsp;picture )
203</h3>
204Constructs an icon view item and inserts it into the icon view <em>parent</em> using <em>text</em> as the text and <em>picture</em> as the icon, after
205the icon view item <em>after</em>.
206
207<h3 class=fn><a name="~QIconViewItem"></a>QIconViewItem::~QIconViewItem ()<tt> [virtual]</tt>
208</h3>
209Destroys the icon view item and tells the parent icon view that
210the item has been destroyed.
211
212<h3 class=fn>bool <a name="acceptDrop"></a>QIconViewItem::acceptDrop ( const&nbsp;<a href="qmimesource.html">QMimeSource</a>&nbsp;*&nbsp;mime ) const<tt> [virtual]</tt>
213</h3>
214
215<p> Returns TRUE if you can drop things with a <a href="qmimesource.html">QMimeSource</a> of <em>mime</em>
216onto this item; otherwise returns FALSE.
217<p> The default implementation always returns FALSE. You must subclass
218QIconViewItem and reimplement <a href="#acceptDrop">acceptDrop</a>() to accept drops.
219
220<p>Examples: <a href="fileiconview-example.html#x836">fileiconview/qfileiconview.cpp</a> and <a href="simple_dd-example.html#x2822">iconview/simple_dd/main.cpp</a>.
221<h3 class=fn>void <a name="calcRect"></a>QIconViewItem::calcRect ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text_ = QString::null )<tt> [virtual protected]</tt>
222</h3>
223This virtual function is responsible for calculating the
224rectangles returned by <a href="#rect">rect</a>(), <a href="#textRect">textRect</a>() and <a href="#pixmapRect">pixmapRect</a>().
225setRect(), <a href="#setTextRect">setTextRect</a>() and <a href="#setPixmapRect">setPixmapRect</a>() are provided mainly
226for reimplementations of this function.
227<p> <em>text_</em> is an internal parameter which defaults to <a href="qstring.html#QString-null">QString::null</a>.
228
229<h3 class=fn>int <a name="compare"></a>QIconViewItem::compare ( <a href="qiconviewitem.html">QIconViewItem</a>&nbsp;*&nbsp;i ) const<tt> [virtual]</tt>
230</h3>
231Compares this icon view item to <em>i</em>. Returns -1 if this item is
232less than <em>i</em>, 0 if they are equal, and 1 if this icon view item
233is greater than <em>i</em>.
234<p> The default implementation compares the item keys (<a href="#key">key</a>()) using
235<a href="qstring.html#localeAwareCompare">QString::localeAwareCompare</a>(). A reimplementation may use
236different values and a different comparison function. Here is a
237reimplementation that uses plain Unicode comparison:
238<p> <pre>
239 int MyIconViewItem::compare( QIconViewItem *i ) const
240 {
241 return key().compare( i-&gt;<a href="#key">key</a>() );
242 }
243 </pre>
244
245<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>().
246
247<h3 class=fn>bool <a name="contains"></a>QIconViewItem::contains ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pnt ) const
248</h3>
249Returns TRUE if the item contains the point <em>pnt</em> (in contents
250coordinates); otherwise returns FALSE.
251
252<h3 class=fn>bool <a name="dragEnabled"></a>QIconViewItem::dragEnabled () const
253</h3>
254Returns TRUE if the user is allowed to drag the icon view item;
255otherwise returns FALSE.
256<p> <p>See also <a href="#setDragEnabled">setDragEnabled</a>().
257
258<h3 class=fn>void <a name="dragEntered"></a>QIconViewItem::dragEntered ()<tt> [virtual protected]</tt>
259</h3>
260This function is called when a drag enters the item's bounding
261rectangle.
262<p> The default implementation does nothing; subclasses may
263reimplement this function.
264
265<p>Example: <a href="fileiconview-example.html#x837">fileiconview/qfileiconview.cpp</a>.
266<h3 class=fn>void <a name="dragLeft"></a>QIconViewItem::dragLeft ()<tt> [virtual protected]</tt>
267</h3>
268This function is called when a drag leaves the item's bounding
269rectangle.
270<p> The default implementation does nothing; subclasses may
271reimplement this function.
272
273<p>Example: <a href="fileiconview-example.html#x838">fileiconview/qfileiconview.cpp</a>.
274<h3 class=fn>bool <a name="dropEnabled"></a>QIconViewItem::dropEnabled () const
275</h3>
276Returns TRUE if the user is allowed to drop something onto the
277item; otherwise returns FALSE.
278<p> <p>See also <a href="#setDropEnabled">setDropEnabled</a>().
279
280<h3 class=fn>void <a name="dropped"></a>QIconViewItem::dropped ( <a href="qdropevent.html">QDropEvent</a>&nbsp;*&nbsp;e, const&nbsp;<a href="qvaluelist.html">QValueList</a>&lt;QIconDragItem&gt;&nbsp;&amp;&nbsp;lst )<tt> [virtual protected]</tt>
281</h3>
282
283<p> This function is called when something is dropped on the item. <em>e</em> provides all the information about the drop. If the drag object
284of the drop was a <a href="qicondrag.html">QIconDrag</a>, <em>lst</em> contains the list of the
285dropped items. You can get the data by calling
286<a href="qicondragitem.html#data">QIconDragItem::data</a>() on each item. If the <em>lst</em> is empty, i.e.
287the drag was not a QIconDrag, you must decode the data in <em>e</em> and
288work with that.
289<p> The default implementation does nothing; subclasses may
290reimplement this function.
291
292<p>Examples: <a href="fileiconview-example.html#x839">fileiconview/qfileiconview.cpp</a> and <a href="simple_dd-example.html#x2823">iconview/simple_dd/main.cpp</a>.
293<h3 class=fn>int <a name="height"></a>QIconViewItem::height () const
294</h3>
295Returns the height of the item.
296
297<h3 class=fn><a href="qiconview.html">QIconView</a>&nbsp;* <a name="iconView"></a>QIconViewItem::iconView () const
298</h3>
299Returns a pointer to this item's icon view parent.
300
301<h3 class=fn>int <a name="index"></a>QIconViewItem::index () const
302</h3>
303Returns the index of this item in the icon view, or -1 if an error
304occurred.
305
306<h3 class=fn>bool <a name="intersects"></a>QIconViewItem::intersects ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
307</h3>
308Returns TRUE if the item intersects the rectangle <em>r</em> (in
309contents coordinates); otherwise returns FALSE.
310
311<h3 class=fn>bool <a name="isSelectable"></a>QIconViewItem::isSelectable () const
312</h3>
313Returns TRUE if the item is selectable; otherwise returns FALSE.
314<p> <p>See also <a href="#setSelectable">setSelectable</a>().
315
316<h3 class=fn>bool <a name="isSelected"></a>QIconViewItem::isSelected () const
317</h3>
318Returns TRUE if the item is selected; otherwise returns FALSE.
319<p> <p>See also <a href="#setSelected">setSelected</a>().
320
321<p>Example: <a href="fileiconview-example.html#x840">fileiconview/qfileiconview.cpp</a>.
322<h3 class=fn><a href="qstring.html">QString</a> <a name="key"></a>QIconViewItem::key () const<tt> [virtual]</tt>
323</h3>
324Returns the key of the icon view item or <a href="#text">text</a>() if no key has been
325explicitly set.
326<p> <p>See also <a href="#setKey">setKey</a>() and <a href="#compare">compare</a>().
327
328<h3 class=fn>bool <a name="move"></a>QIconViewItem::move ( int&nbsp;x, int&nbsp;y )<tt> [virtual]</tt>
329</h3>
330Moves the item to position (<em>x</em>, <em>y</em>) in the icon view (these
331are contents coordinates).
332
333<h3 class=fn>bool <a name="move-2"></a>QIconViewItem::move ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pnt )<tt> [virtual]</tt>
334</h3>
335This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
336<p> Moves the item to the point <em>pnt</em>.
337
338<h3 class=fn>void <a name="moveBy"></a>QIconViewItem::moveBy ( int&nbsp;dx, int&nbsp;dy )<tt> [virtual]</tt>
339</h3>
340Moves the item <em>dx</em> pixels in the x-direction and <em>dy</em> pixels in
341the y-direction.
342
343<h3 class=fn>void <a name="moveBy-2"></a>QIconViewItem::moveBy ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;pnt )<tt> [virtual]</tt>
344</h3>
345This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
346<p> Moves the item by the x, y values in point <em>pnt</em>.
347
348<h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a>&nbsp;* <a name="nextItem"></a>QIconViewItem::nextItem () const
349</h3>
350Returns a pointer to the next item, or 0 if this is the last item
351in the icon view.
352<p> To find the first item use <a href="qiconview.html#firstItem">QIconView::firstItem</a>().
353<p> Example:
354<pre>
355 QIconViewItem *item;
356 for ( item = iconView-&gt;firstItem(); item; item = item-&gt;<a href="#nextItem">nextItem</a>() )
357 do_something_with( item );
358 </pre>
359
360<p> <p>See also <a href="#prevItem">prevItem</a>().
361
362<p>Example: <a href="fileiconview-example.html#x841">fileiconview/qfileiconview.cpp</a>.
363<h3 class=fn>void <a name="paintFocus"></a>QIconViewItem::paintFocus ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;cg )<tt> [virtual protected]</tt>
364</h3>
365Paints the focus rectangle of the item using the painter <em>p</em> and
366the color group <em>cg</em>.
367
368<h3 class=fn>void <a name="paintItem"></a>QIconViewItem::paintItem ( <a href="qpainter.html">QPainter</a>&nbsp;*&nbsp;p, const&nbsp;<a href="qcolorgroup.html">QColorGroup</a>&nbsp;&amp;&nbsp;cg )<tt> [virtual protected]</tt>
369</h3>
370Paints the item using the painter <em>p</em> and the color group <em>cg</em>.
371If you want the item to be drawn with a different font or color,
372reimplement this function, change the values of the color group or
373the painter's font, and then call the <a href="#paintItem">QIconViewItem::paintItem</a>()
374with the changed values.
375
376<p>Example: <a href="fileiconview-example.html#x842">fileiconview/qfileiconview.cpp</a>.
377<h3 class=fn><a href="qpicture.html">QPicture</a>&nbsp;* <a name="picture"></a>QIconViewItem::picture () const<tt> [virtual]</tt>
378</h3>
379Returns the icon of the icon view item if it is a picture, or 0 if
380it is a pixmap. In the latter case use <a href="#pixmap">pixmap</a>() instead. Normally
381you set the picture of the item with <a href="#setPicture">setPicture</a>(), but sometimes
382it's inconvenient to call setPicture() for every item. So you can
383subclass QIconViewItem, reimplement this function and return a
384pointer to the item's picture. If you do this, you <em>must</em> call
385<a href="#calcRect">calcRect</a>() manually each time the size of this picture changes.
386<p> <p>See also <a href="#setPicture">setPicture</a>().
387
388<h3 class=fn><a href="qpixmap.html">QPixmap</a>&nbsp;* <a name="pixmap"></a>QIconViewItem::pixmap () const<tt> [virtual]</tt>
389</h3>
390Returns the icon of the icon view item if it is a pixmap, or 0 if
391it is a picture. In the latter case use <a href="#picture">picture</a>() instead.
392Normally you set the pixmap of the item with <a href="#setPixmap">setPixmap</a>(), but
393sometimes it's inconvenient to call setPixmap() for every item. So
394you can subclass QIconViewItem, reimplement this function and
395return a pointer to the item's pixmap. If you do this, you <em>must</em>
396call <a href="#calcRect">calcRect</a>() manually each time the size of this pixmap
397changes.
398<p> <p>See also <a href="#setPixmap">setPixmap</a>().
399
400<p>Example: <a href="fileiconview-example.html#x843">fileiconview/qfileiconview.cpp</a>.
401<h3 class=fn><a href="qrect.html">QRect</a> <a name="pixmapRect"></a>QIconViewItem::pixmapRect ( bool&nbsp;relative = TRUE ) const
402</h3>
403Returns the bounding rectangle of the item's icon.
404<p> If <em>relative</em> is TRUE, (the default), the rectangle is relative to
405the origin of the item's rectangle. If <em>relative</em> is FALSE, the
406returned rectangle is relative to the origin of the icon view's
407contents coordinate system.
408
409<p>Example: <a href="fileiconview-example.html#x844">fileiconview/qfileiconview.cpp</a>.
410<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="pos"></a>QIconViewItem::pos () const
411</h3>
412Returns the position of the item (in contents coordinates).
413
414<h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a>&nbsp;* <a name="prevItem"></a>QIconViewItem::prevItem () const
415</h3>
416Returns a pointer to the previous item, or 0 if this is the first
417item in the icon view.
418<p> <p>See also <a href="#nextItem">nextItem</a>() and <a href="qiconview.html#firstItem">QIconView::firstItem</a>().
419
420<h3 class=fn><a href="qrect.html">QRect</a> <a name="rect"></a>QIconViewItem::rect () const
421</h3>
422Returns the bounding rectangle of the item (in contents
423coordinates).
424
425<h3 class=fn>void <a name="removeRenameBox"></a>QIconViewItem::removeRenameBox ()<tt> [virtual protected]</tt>
426</h3>
427Removes the editbox that is used for in-place renaming.
428
429<h3 class=fn>void <a name="rename"></a>QIconViewItem::rename ()
430</h3>
431Starts in-place renaming of an icon, if allowed.
432<p> This function sets up the icon view so that the user can edit the
433item text, and then returns. When the user is done, <a href="#setText">setText</a>() will
434be called and <a href="qiconview.html#itemRenamed">QIconView::itemRenamed</a>() will be emitted (unless the
435user canceled, e.g. by pressing the Escape key).
436<p> <p>See also <a href="#setRenameEnabled">setRenameEnabled</a>().
437
438<p>Example: <a href="fileiconview-example.html#x845">fileiconview/qfileiconview.cpp</a>.
439<h3 class=fn>bool <a name="renameEnabled"></a>QIconViewItem::renameEnabled () const
440</h3>
441Returns TRUE if the item can be renamed by the user with in-place
442renaming; otherwise returns FALSE.
443<p> <p>See also <a href="#setRenameEnabled">setRenameEnabled</a>().
444
445<p>Example: <a href="fileiconview-example.html#x846">fileiconview/qfileiconview.cpp</a>.
446<h3 class=fn>void <a name="repaint"></a>QIconViewItem::repaint ()<tt> [virtual]</tt>
447</h3>
448Repaints the item.
449
450<h3 class=fn>int <a name="rtti"></a>QIconViewItem::rtti () const<tt> [virtual]</tt>
451</h3>
452Returns 0.
453<p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), so
454that you can distinguish between icon view item types. You should
455use values greater than 1000, preferably a large random number, to
456allow for extensions to this class.
457
458<h3 class=fn>void <a name="setDragEnabled"></a>QIconViewItem::setDragEnabled ( bool&nbsp;allow )<tt> [virtual]</tt>
459</h3>
460If <em>allow</em> is TRUE, the icon view permits the user to drag the
461icon view item either to another position within the icon view or
462to somewhere outside of it. If <em>allow</em> is FALSE, the item cannot
463be dragged.
464
465<h3 class=fn>void <a name="setDropEnabled"></a>QIconViewItem::setDropEnabled ( bool&nbsp;allow )<tt> [virtual]</tt>
466</h3>
467If <em>allow</em> is TRUE, the icon view lets the user drop something on
468this icon view item.
469
470<h3 class=fn>void <a name="setItemRect"></a>QIconViewItem::setItemRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )<tt> [protected]</tt>
471</h3>
472Sets the bounding rectangle of the whole item to <em>r</em>. This
473function is provided for subclasses which reimplement <a href="#calcRect">calcRect</a>(),
474so that they can set the calculated rectangle. <em>Any other use is discouraged.</em>
475<p> <p>See also <a href="#calcRect">calcRect</a>(), <a href="#textRect">textRect</a>(), <a href="#setTextRect">setTextRect</a>(), <a href="#pixmapRect">pixmapRect</a>(), and <a href="#setPixmapRect">setPixmapRect</a>().
476
477<h3 class=fn>void <a name="setKey"></a>QIconViewItem::setKey ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;k )<tt> [virtual]</tt>
478</h3>
479Sets <em>k</em> as the sort key of the icon view item. By default
480<a href="#text">text</a>() is used for sorting.
481<p> <p>See also <a href="#compare">compare</a>().
482
483<p>Example: <a href="fileiconview-example.html#x847">fileiconview/qfileiconview.cpp</a>.
484<h3 class=fn>void <a name="setPicture"></a>QIconViewItem::setPicture ( const&nbsp;<a href="qpicture.html">QPicture</a>&nbsp;&amp;&nbsp;icon )<tt> [virtual]</tt>
485</h3>
486Sets <em>icon</em> as the item's icon in the icon view. This function
487might be a no-op if you reimplement <a href="#picture">picture</a>().
488<p> <p>See also <a href="#picture">picture</a>().
489
490<h3 class=fn>void <a name="setPixmap"></a>QIconViewItem::setPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;icon )<tt> [virtual]</tt>
491</h3>
492Sets <em>icon</em> as the item's icon in the icon view. This function
493might be a no-op if you reimplement <a href="#pixmap">pixmap</a>().
494<p> <b>Note:</b> Pixmaps with individual dimensions larger than 300 pixels may
495not be displayed properly, depending on the <a href="qiconview.html#Arrangement-enum">arrangement in use</a>. See the <a href="#pixmap-size-limit">main class
496 documentation</a> for details.
497<p> <p>See also <a href="#pixmap">pixmap</a>().
498
499<h3 class=fn>void <a name="setPixmap-2"></a>QIconViewItem::setPixmap ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;icon, bool&nbsp;recalc, bool&nbsp;redraw = TRUE )<tt> [virtual]</tt>
500</h3>
501This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
502<p> Sets <em>icon</em> as the item's icon in the icon view. If <em>recalc</em> is
503TRUE, the icon view's layout is recalculated. If <em>redraw</em> is TRUE
504(the default), the icon view is repainted.
505<p> <b>Note:</b> Pixmaps with individual dimensions larger than 300 pixels may
506not be displayed properly, depending on the <a href="qiconview.html#Arrangement-enum">arrangement in use</a>. See the <a href="#pixmap-size-limit">main class
507 documentation</a> for details.
508<p> <p>See also <a href="#pixmap">pixmap</a>().
509
510<h3 class=fn>void <a name="setPixmapRect"></a>QIconViewItem::setPixmapRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )<tt> [protected]</tt>
511</h3>
512Sets the bounding rectangle of the item's icon to <em>r</em>. This
513function is provided for subclasses which reimplement <a href="#calcRect">calcRect</a>(),
514so that they can set the calculated rectangle. <em>Any other use is discouraged.</em>
515<p> <p>See also <a href="#calcRect">calcRect</a>(), <a href="#pixmapRect">pixmapRect</a>(), <a href="#setItemRect">setItemRect</a>(), and <a href="#setTextRect">setTextRect</a>().
516
517<h3 class=fn>void <a name="setRenameEnabled"></a>QIconViewItem::setRenameEnabled ( bool&nbsp;allow )<tt> [virtual]</tt>
518</h3>
519If <em>allow</em> is TRUE, the user can rename the icon view item by
520clicking on the text (or pressing F2) while the item is selected
521(in-place renaming). If <em>allow</em> is FALSE, in-place renaming is
522not possible.
523
524<p>Examples: <a href="fileiconview-example.html#x848">fileiconview/qfileiconview.cpp</a>, <a href="iconview-example.html#x1459">iconview/main.cpp</a>, and <a href="simple_dd-example.html#x2824">iconview/simple_dd/main.cpp</a>.
525<h3 class=fn>void <a name="setSelectable"></a>QIconViewItem::setSelectable ( bool&nbsp;enable )<tt> [virtual]</tt>
526</h3>
527Sets this item to be selectable if <em>enable</em> is TRUE (the default)
528or unselectable if <em>enable</em> is FALSE.
529<p> The user is unable to select a non-selectable item using either
530the keyboard or the mouse. (The application programmer can select
531an item in code regardless of this setting.)
532<p> <p>See also <a href="#isSelectable">isSelectable</a>().
533
534<h3 class=fn>void <a name="setSelected"></a>QIconViewItem::setSelected ( bool&nbsp;s, bool&nbsp;cb )<tt> [virtual]</tt>
535</h3>
536Selects or unselects the item, depending on <em>s</em>; it may also
537unselect other items, depending on <a href="qiconview.html#selectionMode">QIconView::selectionMode</a>() and
538<em>cb</em>.
539<p> If <em>s</em> is FALSE, the item is unselected.
540<p> If <em>s</em> is TRUE and QIconView::selectionMode() is <tt>Single</tt>, the
541item is selected and the item previously selected is unselected.
542<p> If <em>s</em> is TRUE and QIconView::selectionMode() is <tt>Extended</tt>, the
543item is selected. If <em>cb</em> is TRUE, the selection state of the
544other items is left unchanged. If <em>cb</em> is FALSE (the default) all
545other items are unselected.
546<p> If <em>s</em> is TRUE and QIconView::selectionMode() is <tt>Multi</tt>, the
547item is selected.
548<p> Note that <em>cb</em> is used only if QIconView::selectionMode() is <tt>Extended</tt>; cb defaults to FALSE.
549<p> All items whose selection status changes repaint themselves.
550
551<p>Example: <a href="fileiconview-example.html#x849">fileiconview/qfileiconview.cpp</a>.
552<h3 class=fn>void <a name="setSelected-2"></a>QIconViewItem::setSelected ( bool&nbsp;s )<tt> [virtual]</tt>
553</h3>
554This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
555<p> This variant is equivalent to calling the other variant with <em>cb</em>
556set to FALSE.
557
558<h3 class=fn>void <a name="setText"></a>QIconViewItem::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text )<tt> [virtual]</tt>
559</h3>
560Sets <em>text</em> as the text of the icon view item. This function
561might be a no-op if you reimplement <a href="#text">text</a>().
562<p> <p>See also <a href="#text">text</a>().
563
564<p>Example: <a href="fileiconview-example.html#x850">fileiconview/qfileiconview.cpp</a>.
565<h3 class=fn>void <a name="setText-2"></a>QIconViewItem::setText ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;text, bool&nbsp;recalc, bool&nbsp;redraw = TRUE )<tt> [virtual]</tt>
566</h3>
567This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
568<p> Sets <em>text</em> as the text of the icon view item. If <em>recalc</em> is
569TRUE, the icon view's layout is recalculated. If <em>redraw</em> is TRUE
570(the default), the icon view is repainted.
571<p> <p>See also <a href="#text">text</a>().
572
573<h3 class=fn>void <a name="setTextRect"></a>QIconViewItem::setTextRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r )<tt> [protected]</tt>
574</h3>
575Sets the bounding rectangle of the item's text to <em>r</em>. This
576function is provided for subclasses which reimplement <a href="#calcRect">calcRect</a>(),
577so that they can set the calculated rectangle. <em>Any other use is discouraged.</em>
578<p> <p>See also <a href="#calcRect">calcRect</a>(), <a href="#textRect">textRect</a>(), <a href="#setItemRect">setItemRect</a>(), and <a href="#setPixmapRect">setPixmapRect</a>().
579
580<h3 class=fn><a href="qsize.html">QSize</a> <a name="size"></a>QIconViewItem::size () const
581</h3>
582Returns the size of the item.
583
584<h3 class=fn><a href="qstring.html">QString</a> <a name="text"></a>QIconViewItem::text () const<tt> [virtual]</tt>
585</h3>
586Returns the text of the icon view item. Normally you set the text
587of the item with <a href="#setText">setText</a>(), but sometimes it's inconvenient to
588call setText() for every item; so you can subclass QIconViewItem,
589reimplement this function, and return the text of the item. If you
590do this, you must call <a href="#calcRect">calcRect</a>() manually each time the text
591(and therefore its size) changes.
592<p> <p>See also <a href="#setText">setText</a>().
593
594<p>Example: <a href="fileiconview-example.html#x851">fileiconview/qfileiconview.cpp</a>.
595<h3 class=fn><a href="qrect.html">QRect</a> <a name="textRect"></a>QIconViewItem::textRect ( bool&nbsp;relative = TRUE ) const
596</h3>
597Returns the bounding rectangle of the item's text.
598<p> If <em>relative</em> is TRUE, (the default), the returned rectangle is
599relative to the origin of the item's rectangle. If <em>relative</em> is
600FALSE, the returned rectangle is relative to the origin of the
601icon view's contents coordinate system.
602
603<p>Example: <a href="fileiconview-example.html#x852">fileiconview/qfileiconview.cpp</a>.
604<h3 class=fn>int <a name="width"></a>QIconViewItem::width () const
605</h3>
606Returns the width of the item.
607
608<h3 class=fn>int <a name="x"></a>QIconViewItem::x () const
609</h3>
610Returns the x-coordinate of the item (in contents coordinates).
611
612<h3 class=fn>int <a name="y"></a>QIconViewItem::y () const
613</h3>
614Returns the y-coordinate of the item (in contents coordinates).
615
616<!-- eof -->
617<hr><p>
618This file is part of the <a href="index.html">Qt toolkit</a>.
619Copyright &copy; 1995-2007
620<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
621<table width=100% cellspacing=0 border=0><tr>
622<td>Copyright &copy; 2007
623<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
624<td align=right><div align=right>Qt 3.3.8</div>
625</table></div></address></body>
626</html>
Note: See TracBrowser for help on using the repository browser.