<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/iconview/qiconview.cpp:800 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>TQIconViewItem Class</title> <style type="text/css"><!-- fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQIconViewItem Class Reference<br><small>[<a href="iconview.html">iconview module</a>]</small></h1> <p>The TQIconViewItem class provides a single item in a TQIconView. <a href="#details">More...</a> <p><tt>#include <<a href="qiconview-h.html">ntqiconview.h</a>></tt> <p>Inherits <a href="ntqt.html">TQt</a>. <p><a href="qiconviewitem-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li class=fn><a href="#TQIconViewItem"><b>TQIconViewItem</b></a> ( TQIconView * parent )</li> <li class=fn><a href="#TQIconViewItem-2"><b>TQIconViewItem</b></a> ( TQIconView * parent, TQIconViewItem * after )</li> <li class=fn><a href="#TQIconViewItem-3"><b>TQIconViewItem</b></a> ( TQIconView * parent, const TQString & text )</li> <li class=fn><a href="#TQIconViewItem-4"><b>TQIconViewItem</b></a> ( TQIconView * parent, TQIconViewItem * after, const TQString & text )</li> <li class=fn><a href="#TQIconViewItem-5"><b>TQIconViewItem</b></a> ( TQIconView * parent, const TQString & text, const TQPixmap & icon )</li> <li class=fn><a href="#TQIconViewItem-6"><b>TQIconViewItem</b></a> ( TQIconView * parent, TQIconViewItem * after, const TQString & text, const TQPixmap & icon )</li> <li class=fn><a href="#TQIconViewItem-7"><b>TQIconViewItem</b></a> ( TQIconView * parent, const TQString & text, const TQPicture & picture )</li> <li class=fn><a href="#TQIconViewItem-8"><b>TQIconViewItem</b></a> ( TQIconView * parent, TQIconViewItem * after, const TQString & text, const TQPicture & picture )</li> <li class=fn>virtual <a href="#~TQIconViewItem"><b>~TQIconViewItem</b></a> ()</li> <li class=fn>virtual void <a href="#setRenameEnabled"><b>setRenameEnabled</b></a> ( bool allow )</li> <li class=fn>virtual void <a href="#setDragEnabled"><b>setDragEnabled</b></a> ( bool allow )</li> <li class=fn>virtual void <a href="#setDropEnabled"><b>setDropEnabled</b></a> ( bool allow )</li> <li class=fn>virtual TQString <a href="#text"><b>text</b></a> () const</li> <li class=fn>virtual TQPixmap * <a href="#pixmap"><b>pixmap</b></a> () const</li> <li class=fn>virtual TQPicture * <a href="#picture"><b>picture</b></a> () const</li> <li class=fn>virtual TQString <a href="#key"><b>key</b></a> () const</li> <li class=fn>bool <a href="#renameEnabled"><b>renameEnabled</b></a> () const</li> <li class=fn>bool <a href="#dragEnabled"><b>dragEnabled</b></a> () const</li> <li class=fn>bool <a href="#dropEnabled"><b>dropEnabled</b></a> () const</li> <li class=fn>TQIconView * <a href="#iconView"><b>iconView</b></a> () const</li> <li class=fn>TQIconViewItem * <a href="#prevItem"><b>prevItem</b></a> () const</li> <li class=fn>TQIconViewItem * <a href="#nextItem"><b>nextItem</b></a> () const</li> <li class=fn>int <a href="#index"><b>index</b></a> () const</li> <li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( bool s, bool cb )</li> <li class=fn>virtual void <a href="#setSelected-2"><b>setSelected</b></a> ( bool s )</li> <li class=fn>virtual void <a href="#setSelectable"><b>setSelectable</b></a> ( bool enable )</li> <li class=fn>bool <a href="#isSelected"><b>isSelected</b></a> () const</li> <li class=fn>bool <a href="#isSelectable"><b>isSelectable</b></a> () const</li> <li class=fn>virtual void <a href="#repaint"><b>repaint</b></a> ()</li> <li class=fn>virtual bool <a href="#move"><b>move</b></a> ( int x, int y )</li> <li class=fn>virtual void <a href="#moveBy"><b>moveBy</b></a> ( int dx, int dy )</li> <li class=fn>virtual bool <a href="#move-2"><b>move</b></a> ( const TQPoint & pnt )</li> <li class=fn>virtual void <a href="#moveBy-2"><b>moveBy</b></a> ( const TQPoint & pnt )</li> <li class=fn>TQRect <a href="#rect"><b>rect</b></a> () const</li> <li class=fn>int <a href="#x"><b>x</b></a> () const</li> <li class=fn>int <a href="#y"><b>y</b></a> () const</li> <li class=fn>int <a href="#width"><b>width</b></a> () const</li> <li class=fn>int <a href="#height"><b>height</b></a> () const</li> <li class=fn>TQSize <a href="#size"><b>size</b></a> () const</li> <li class=fn>TQPoint <a href="#pos"><b>pos</b></a> () const</li> <li class=fn>TQRect <a href="#textRect"><b>textRect</b></a> ( bool relative = TRUE ) const</li> <li class=fn>TQRect <a href="#pixmapRect"><b>pixmapRect</b></a> ( bool relative = TRUE ) const</li> <li class=fn>bool <a href="#contains"><b>contains</b></a> ( const TQPoint & pnt ) const</li> <li class=fn>bool <a href="#intersects"><b>intersects</b></a> ( const TQRect & r ) const</li> <li class=fn>virtual bool <a href="#acceptDrop"><b>acceptDrop</b></a> ( const TQMimeSource * mime ) const</li> <li class=fn>void <a href="#rename"><b>rename</b></a> ()</li> <li class=fn>virtual int <a href="#compare"><b>compare</b></a> ( TQIconViewItem * i ) const</li> <li class=fn>virtual void <a href="#setText"><b>setText</b></a> ( const TQString & text )</li> <li class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( const TQPixmap & icon )</li> <li class=fn>virtual void <a href="#setPicture"><b>setPicture</b></a> ( const TQPicture & icon )</li> <li class=fn>virtual void <a href="#setText-2"><b>setText</b></a> ( const TQString & text, bool recalc, bool redraw = TRUE )</li> <li class=fn>virtual void <a href="#setPixmap-2"><b>setPixmap</b></a> ( const TQPixmap & icon, bool recalc, bool redraw = TRUE )</li> <li class=fn>virtual void <a href="#setKey"><b>setKey</b></a> ( const TQString & k )</li> <li class=fn>virtual int <a href="#rtti"><b>rtti</b></a> () const</li> </ul> <h2>Protected Members</h2> <ul> <li class=fn>virtual void <a href="#removeRenameBox"><b>removeRenameBox</b></a> ()</li> <li class=fn>virtual void <a href="#calcRect"><b>calcRect</b></a> ( const TQString & text_ = TQString::null )</li> <li class=fn>virtual void <a href="#paintItem"><b>paintItem</b></a> ( TQPainter * p, const TQColorGroup & cg )</li> <li class=fn>virtual void <a href="#paintFocus"><b>paintFocus</b></a> ( TQPainter * p, const TQColorGroup & cg )</li> <li class=fn>virtual void <a href="#dropped"><b>dropped</b></a> ( TQDropEvent * e, const TQValueList<TQIconDragItem> & lst )</li> <li class=fn>virtual void <a href="#dragEntered"><b>dragEntered</b></a> ()</li> <li class=fn>virtual void <a href="#dragLeft"><b>dragLeft</b></a> ()</li> <li class=fn>void <a href="#setItemRect"><b>setItemRect</b></a> ( const TQRect & r )</li> <li class=fn>void <a href="#setTextRect"><b>setTextRect</b></a> ( const TQRect & r )</li> <li class=fn>void <a href="#setPixmapRect"><b>setPixmapRect</b></a> ( const TQRect & r )</li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The TQIconViewItem class provides a single item in a <a href="ntqiconview.html">TQIconView</a>. <p> <p> A TQIconViewItem contains an icon, a string and optionally a sort key, and can display itself in a TQIconView. The class is designed to be very similar to <a href="ntqlistview.html">TQListView</a> and <a href="ntqlistbox.html">TQListBox</a> in use, both via instantiation and subclassing. <p> The simplest way to create a TQIconViewItem and insert it into a TQIconView is to construct the item passing the constructor a pointer to the icon view, a string and an icon: <p> <pre> (void) new TQIconViewItem( iconView, // A pointer to a TQIconView "This is the text of the item", aPixmap ); </pre> <p> By default the text of an icon view item may not be edited by the user but calling <a href="#setRenameEnabled">setRenameEnabled</a>(TRUE) will allow the user to perform in-place editing of the item's text. <p> When the icon view is deleted all items in it are deleted automatically. <p> The <a href="ntqiconview.html#firstItem">TQIconView::firstItem</a>() and <a href="#nextItem">TQIconViewItem::nextItem</a>() functions provide a means of iterating over all the items in a TQIconView: <p> <pre> TQIconViewItem *item; for ( item = iconView->firstItem(); item; item = item-><a href="#nextItem">nextItem</a>() ) do_something_with( item ); </pre> <p> The item's icon view is available from <a href="#iconView">iconView</a>(), and its position in the icon view from <a href="#index">index</a>(). <p> The item's selection status is available from <a href="#isSelected">isSelected</a>() and is set and controlled by <a href="#setSelected">setSelected</a>() and <a href="#isSelectable">isSelectable</a>(). <p> The text and icon can be set with <a href="#setText">setText</a>() and <a href="#setPixmap">setPixmap</a>() and retrieved with <a href="#text">text</a>() and <a href="#pixmap">pixmap</a>(). The item's sort key defaults to text() but may be set with <a href="#setKey">setKey</a>() and retrieved with <a href="#key">key</a>(). The comparison function, <a href="#compare">compare</a>() uses key(). <p> Items may be repositioned with <a href="#move">move</a>() and <a href="#moveBy">moveBy</a>(). An item's geometry 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>(), <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 against the position of a point with <a href="#contains">contains</a>() and <a href="#intersects">intersects</a>(). <p> To remove an item from an icon view, just delete the item. The TQIconViewItem destructor removes it cleanly from its icon view. <p> Because the icon view is designed to use drag-and-drop, the icon view item also has functions for drag-and-drop which may be reimplemented. <p> <a name="pixmap-size-limit"></a> <b>Note:</b> Pixmaps with individual dimensions larger than 300 pixels may not be displayed properly, depending on the <a href="ntqiconview.html#Arrangement-enum">arrangement in use</a>. For example, pixmaps wider than 300 pixels will not be arranged correctly if the icon view uses a <a href="ntqiconview.html#Arrangement-enum">TQIconView::TopToBottom</a> arrangement, and pixmaps taller than 300 pixels will not be arranged correctly if the icon view uses a <a href="ntqiconview.html#Arrangement-enum">TQIconView::LeftToRight</a> arrangement. <p>See also <a href="advanced.html">Advanced Widgets</a>. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="TQIconViewItem"></a>TQIconViewItem::TQIconViewItem ( <a href="ntqiconview.html">TQIconView</a> * parent ) </h3> Constructs a TQIconViewItem and inserts it into icon view <em>parent</em> with no text and a default icon. <h3 class=fn><a name="TQIconViewItem-2"></a>TQIconViewItem::TQIconViewItem ( <a href="ntqiconview.html">TQIconView</a> * parent, <a href="qiconviewitem.html">TQIconViewItem</a> * after ) </h3> Constructs a TQIconViewItem and inserts it into the icon view <em>parent</em> with no text and a default icon, after the icon view item <em>after</em>. <h3 class=fn><a name="TQIconViewItem-3"></a>TQIconViewItem::TQIconViewItem ( <a href="ntqiconview.html">TQIconView</a> * parent, const <a href="ntqstring.html">TQString</a> & text ) </h3> Constructs 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. <h3 class=fn><a name="TQIconViewItem-4"></a>TQIconViewItem::TQIconViewItem ( <a href="ntqiconview.html">TQIconView</a> * parent, <a href="qiconviewitem.html">TQIconViewItem</a> * after, const <a href="ntqstring.html">TQString</a> & text ) </h3> Constructs 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 icon view item <em>after</em>. <h3 class=fn><a name="TQIconViewItem-5"></a>TQIconViewItem::TQIconViewItem ( <a href="ntqiconview.html">TQIconView</a> * parent, const <a href="ntqstring.html">TQString</a> & text, const <a href="ntqpixmap.html">TQPixmap</a> & icon ) </h3> Constructs 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. <h3 class=fn><a name="TQIconViewItem-6"></a>TQIconViewItem::TQIconViewItem ( <a href="ntqiconview.html">TQIconView</a> * parent, <a href="qiconviewitem.html">TQIconViewItem</a> * after, const <a href="ntqstring.html">TQString</a> & text, const <a href="ntqpixmap.html">TQPixmap</a> & icon ) </h3> Constructs 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 the icon view item <em>after</em>. <p> <p>See also <a href="#setPixmap">setPixmap</a>(). <h3 class=fn><a name="TQIconViewItem-7"></a>TQIconViewItem::TQIconViewItem ( <a href="ntqiconview.html">TQIconView</a> * parent, const <a href="ntqstring.html">TQString</a> & text, const <a href="ntqpicture.html">TQPicture</a> & picture ) </h3> Constructs 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. <h3 class=fn><a name="TQIconViewItem-8"></a>TQIconViewItem::TQIconViewItem ( <a href="ntqiconview.html">TQIconView</a> * parent, <a href="qiconviewitem.html">TQIconViewItem</a> * after, const <a href="ntqstring.html">TQString</a> & text, const <a href="ntqpicture.html">TQPicture</a> & picture ) </h3> Constructs 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 the icon view item <em>after</em>. <h3 class=fn><a name="~TQIconViewItem"></a>TQIconViewItem::~TQIconViewItem ()<tt> [virtual]</tt> </h3> Destroys the icon view item and tells the parent icon view that the item has been destroyed. <h3 class=fn>bool <a name="acceptDrop"></a>TQIconViewItem::acceptDrop ( const <a href="qmimesource.html">TQMimeSource</a> * mime ) const<tt> [virtual]</tt> </h3> <p> Returns TRUE if you can drop things with a <a href="qmimesource.html">TQMimeSource</a> of <em>mime</em> onto this item; otherwise returns FALSE. <p> The default implementation always returns FALSE. You must subclass TQIconViewItem and reimplement <a href="#acceptDrop">acceptDrop</a>() to accept drops. <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>. <h3 class=fn>void <a name="calcRect"></a>TQIconViewItem::calcRect ( const <a href="ntqstring.html">TQString</a> & text_ = TQString::null )<tt> [virtual protected]</tt> </h3> This virtual function is responsible for calculating the rectangles returned by <a href="#rect">rect</a>(), <a href="#textRect">textRect</a>() and <a href="#pixmapRect">pixmapRect</a>(). setRect(), <a href="#setTextRect">setTextRect</a>() and <a href="#setPixmapRect">setPixmapRect</a>() are provided mainly for reimplementations of this function. <p> <em>text_</em> is an internal parameter which defaults to <a href="ntqstring.html#TQString-null">TQString::null</a>. <h3 class=fn>int <a name="compare"></a>TQIconViewItem::compare ( <a href="qiconviewitem.html">TQIconViewItem</a> * i ) const<tt> [virtual]</tt> </h3> Compares this icon view item to <em>i</em>. Returns -1 if this item is less than <em>i</em>, 0 if they are equal, and 1 if this icon view item is greater than <em>i</em>. <p> The default implementation compares the item keys (<a href="#key">key</a>()) using <a href="ntqstring.html#localeAwareCompare">TQString::localeAwareCompare</a>(). A reimplementation may use different values and a different comparison function. Here is a reimplementation that uses plain Unicode comparison: <p> <pre> int MyIconViewItem::compare( TQIconViewItem *i ) const { return key().compare( i-><a href="#key">key</a>() ); } </pre> <p> <p>See also <a href="#key">key</a>(), <a href="ntqstring.html#localeAwareCompare">TQString::localeAwareCompare</a>(), and <a href="ntqstring.html#compare">TQString::compare</a>(). <h3 class=fn>bool <a name="contains"></a>TQIconViewItem::contains ( const <a href="ntqpoint.html">TQPoint</a> & pnt ) const </h3> Returns TRUE if the item contains the point <em>pnt</em> (in contents coordinates); otherwise returns FALSE. <h3 class=fn>bool <a name="dragEnabled"></a>TQIconViewItem::dragEnabled () const </h3> Returns TRUE if the user is allowed to drag the icon view item; otherwise returns FALSE. <p> <p>See also <a href="#setDragEnabled">setDragEnabled</a>(). <h3 class=fn>void <a name="dragEntered"></a>TQIconViewItem::dragEntered ()<tt> [virtual protected]</tt> </h3> This function is called when a drag enters the item's bounding rectangle. <p> The default implementation does nothing; subclasses may reimplement this function. <p>Example: <a href="fileiconview-example.html#x837">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>void <a name="dragLeft"></a>TQIconViewItem::dragLeft ()<tt> [virtual protected]</tt> </h3> This function is called when a drag leaves the item's bounding rectangle. <p> The default implementation does nothing; subclasses may reimplement this function. <p>Example: <a href="fileiconview-example.html#x838">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>bool <a name="dropEnabled"></a>TQIconViewItem::dropEnabled () const </h3> Returns TRUE if the user is allowed to drop something onto the item; otherwise returns FALSE. <p> <p>See also <a href="#setDropEnabled">setDropEnabled</a>(). <h3 class=fn>void <a name="dropped"></a>TQIconViewItem::dropped ( <a href="qdropevent.html">TQDropEvent</a> * e, const <a href="ntqvaluelist.html">TQValueList</a><TQIconDragItem> & lst )<tt> [virtual protected]</tt> </h3> <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 of the drop was a <a href="qicondrag.html">TQIconDrag</a>, <em>lst</em> contains the list of the dropped items. You can get the data by calling <a href="qicondragitem.html#data">TQIconDragItem::data</a>() on each item. If the <em>lst</em> is empty, i.e. the drag was not a TQIconDrag, you must decode the data in <em>e</em> and work with that. <p> The default implementation does nothing; subclasses may reimplement this function. <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>. <h3 class=fn>int <a name="height"></a>TQIconViewItem::height () const </h3> Returns the height of the item. <h3 class=fn><a href="ntqiconview.html">TQIconView</a> * <a name="iconView"></a>TQIconViewItem::iconView () const </h3> Returns a pointer to this item's icon view parent. <h3 class=fn>int <a name="index"></a>TQIconViewItem::index () const </h3> Returns the index of this item in the icon view, or -1 if an error occurred. <h3 class=fn>bool <a name="intersects"></a>TQIconViewItem::intersects ( const <a href="ntqrect.html">TQRect</a> & r ) const </h3> Returns TRUE if the item intersects the rectangle <em>r</em> (in contents coordinates); otherwise returns FALSE. <h3 class=fn>bool <a name="isSelectable"></a>TQIconViewItem::isSelectable () const </h3> Returns TRUE if the item is selectable; otherwise returns FALSE. <p> <p>See also <a href="#setSelectable">setSelectable</a>(). <h3 class=fn>bool <a name="isSelected"></a>TQIconViewItem::isSelected () const </h3> Returns TRUE if the item is selected; otherwise returns FALSE. <p> <p>See also <a href="#setSelected">setSelected</a>(). <p>Example: <a href="fileiconview-example.html#x840">fileiconview/qfileiconview.cpp</a>. <h3 class=fn><a href="ntqstring.html">TQString</a> <a name="key"></a>TQIconViewItem::key () const<tt> [virtual]</tt> </h3> Returns the key of the icon view item or <a href="#text">text</a>() if no key has been explicitly set. <p> <p>See also <a href="#setKey">setKey</a>() and <a href="#compare">compare</a>(). <h3 class=fn>bool <a name="move"></a>TQIconViewItem::move ( int x, int y )<tt> [virtual]</tt> </h3> Moves the item to position (<em>x</em>, <em>y</em>) in the icon view (these are contents coordinates). <h3 class=fn>bool <a name="move-2"></a>TQIconViewItem::move ( const <a href="ntqpoint.html">TQPoint</a> & pnt )<tt> [virtual]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Moves the item to the point <em>pnt</em>. <h3 class=fn>void <a name="moveBy"></a>TQIconViewItem::moveBy ( int dx, int dy )<tt> [virtual]</tt> </h3> Moves the item <em>dx</em> pixels in the x-direction and <em>dy</em> pixels in the y-direction. <h3 class=fn>void <a name="moveBy-2"></a>TQIconViewItem::moveBy ( const <a href="ntqpoint.html">TQPoint</a> & pnt )<tt> [virtual]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Moves the item by the x, y values in point <em>pnt</em>. <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="nextItem"></a>TQIconViewItem::nextItem () const </h3> Returns a pointer to the next item, or 0 if this is the last item in the icon view. <p> To find the first item use <a href="ntqiconview.html#firstItem">TQIconView::firstItem</a>(). <p> Example: <pre> TQIconViewItem *item; for ( item = iconView->firstItem(); item; item = item-><a href="#nextItem">nextItem</a>() ) do_something_with( item ); </pre> <p> <p>See also <a href="#prevItem">prevItem</a>(). <p>Example: <a href="fileiconview-example.html#x841">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>void <a name="paintFocus"></a>TQIconViewItem::paintFocus ( <a href="ntqpainter.html">TQPainter</a> * p, const <a href="qcolorgroup.html">TQColorGroup</a> & cg )<tt> [virtual protected]</tt> </h3> Paints the focus rectangle of the item using the painter <em>p</em> and the color group <em>cg</em>. <h3 class=fn>void <a name="paintItem"></a>TQIconViewItem::paintItem ( <a href="ntqpainter.html">TQPainter</a> * p, const <a href="qcolorgroup.html">TQColorGroup</a> & cg )<tt> [virtual protected]</tt> </h3> Paints the item using the painter <em>p</em> and the color group <em>cg</em>. If you want the item to be drawn with a different font or color, reimplement this function, change the values of the color group or the painter's font, and then call the <a href="#paintItem">TQIconViewItem::paintItem</a>() with the changed values. <p>Example: <a href="fileiconview-example.html#x842">fileiconview/qfileiconview.cpp</a>. <h3 class=fn><a href="ntqpicture.html">TQPicture</a> * <a name="picture"></a>TQIconViewItem::picture () const<tt> [virtual]</tt> </h3> Returns the icon of the icon view item if it is a picture, or 0 if it is a pixmap. In the latter case use <a href="#pixmap">pixmap</a>() instead. Normally you set the picture of the item with <a href="#setPicture">setPicture</a>(), but sometimes it's inconvenient to call setPicture() for every item. So you can subclass TQIconViewItem, reimplement this function and return a pointer to the item's picture. If you do this, you <em>must</em> call <a href="#calcRect">calcRect</a>() manually each time the size of this picture changes. <p> <p>See also <a href="#setPicture">setPicture</a>(). <h3 class=fn><a href="ntqpixmap.html">TQPixmap</a> * <a name="pixmap"></a>TQIconViewItem::pixmap () const<tt> [virtual]</tt> </h3> Returns the icon of the icon view item if it is a pixmap, or 0 if it is a picture. In the latter case use <a href="#picture">picture</a>() instead. Normally you set the pixmap of the item with <a href="#setPixmap">setPixmap</a>(), but sometimes it's inconvenient to call setPixmap() for every item. So you can subclass TQIconViewItem, reimplement this function and return a pointer to the item's pixmap. If you do this, you <em>must</em> call <a href="#calcRect">calcRect</a>() manually each time the size of this pixmap changes. <p> <p>See also <a href="#setPixmap">setPixmap</a>(). <p>Example: <a href="fileiconview-example.html#x843">fileiconview/qfileiconview.cpp</a>. <h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="pixmapRect"></a>TQIconViewItem::pixmapRect ( bool relative = TRUE ) const </h3> Returns the bounding rectangle of the item's icon. <p> If <em>relative</em> is TRUE, (the default), the rectangle is relative to the origin of the item's rectangle. If <em>relative</em> is FALSE, the returned rectangle is relative to the origin of the icon view's contents coordinate system. <p>Example: <a href="fileiconview-example.html#x844">fileiconview/qfileiconview.cpp</a>. <h3 class=fn><a href="ntqpoint.html">TQPoint</a> <a name="pos"></a>TQIconViewItem::pos () const </h3> Returns the position of the item (in contents coordinates). <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="prevItem"></a>TQIconViewItem::prevItem () const </h3> Returns a pointer to the previous item, or 0 if this is the first item in the icon view. <p> <p>See also <a href="#nextItem">nextItem</a>() and <a href="ntqiconview.html#firstItem">TQIconView::firstItem</a>(). <h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="rect"></a>TQIconViewItem::rect () const </h3> Returns the bounding rectangle of the item (in contents coordinates). <h3 class=fn>void <a name="removeRenameBox"></a>TQIconViewItem::removeRenameBox ()<tt> [virtual protected]</tt> </h3> Removes the editbox that is used for in-place renaming. <h3 class=fn>void <a name="rename"></a>TQIconViewItem::rename () </h3> Starts in-place renaming of an icon, if allowed. <p> This function sets up the icon view so that the user can edit the item text, and then returns. When the user is done, <a href="#setText">setText</a>() will be called and <a href="ntqiconview.html#itemRenamed">TQIconView::itemRenamed</a>() will be emitted (unless the user canceled, e.g. by pressing the Escape key). <p> <p>See also <a href="#setRenameEnabled">setRenameEnabled</a>(). <p>Example: <a href="fileiconview-example.html#x845">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>bool <a name="renameEnabled"></a>TQIconViewItem::renameEnabled () const </h3> Returns TRUE if the item can be renamed by the user with in-place renaming; otherwise returns FALSE. <p> <p>See also <a href="#setRenameEnabled">setRenameEnabled</a>(). <p>Example: <a href="fileiconview-example.html#x846">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>void <a name="repaint"></a>TQIconViewItem::repaint ()<tt> [virtual]</tt> </h3> Repaints the item. <h3 class=fn>int <a name="rtti"></a>TQIconViewItem::rtti () const<tt> [virtual]</tt> </h3> Returns 0. <p> Make your derived classes return their own values for <a href="#rtti">rtti</a>(), so that you can distinguish between icon view item types. You should use values greater than 1000, preferably a large random number, to allow for extensions to this class. <h3 class=fn>void <a name="setDragEnabled"></a>TQIconViewItem::setDragEnabled ( bool allow )<tt> [virtual]</tt> </h3> If <em>allow</em> is TRUE, the icon view permits the user to drag the icon view item either to another position within the icon view or to somewhere outside of it. If <em>allow</em> is FALSE, the item cannot be dragged. <h3 class=fn>void <a name="setDropEnabled"></a>TQIconViewItem::setDropEnabled ( bool allow )<tt> [virtual]</tt> </h3> If <em>allow</em> is TRUE, the icon view lets the user drop something on this icon view item. <h3 class=fn>void <a name="setItemRect"></a>TQIconViewItem::setItemRect ( const <a href="ntqrect.html">TQRect</a> & r )<tt> [protected]</tt> </h3> Sets the bounding rectangle of the whole item to <em>r</em>. This function is provided for subclasses which reimplement <a href="#calcRect">calcRect</a>(), so that they can set the calculated rectangle. <em>Any other use is discouraged.</em> <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>(). <h3 class=fn>void <a name="setKey"></a>TQIconViewItem::setKey ( const <a href="ntqstring.html">TQString</a> & k )<tt> [virtual]</tt> </h3> Sets <em>k</em> as the sort key of the icon view item. By default <a href="#text">text</a>() is used for sorting. <p> <p>See also <a href="#compare">compare</a>(). <p>Example: <a href="fileiconview-example.html#x847">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>void <a name="setPicture"></a>TQIconViewItem::setPicture ( const <a href="ntqpicture.html">TQPicture</a> & icon )<tt> [virtual]</tt> </h3> Sets <em>icon</em> as the item's icon in the icon view. This function might be a no-op if you reimplement <a href="#picture">picture</a>(). <p> <p>See also <a href="#picture">picture</a>(). <h3 class=fn>void <a name="setPixmap"></a>TQIconViewItem::setPixmap ( const <a href="ntqpixmap.html">TQPixmap</a> & icon )<tt> [virtual]</tt> </h3> Sets <em>icon</em> as the item's icon in the icon view. This function might be a no-op if you reimplement <a href="#pixmap">pixmap</a>(). <p> <b>Note:</b> Pixmaps with individual dimensions larger than 300 pixels may not be displayed properly, depending on the <a href="ntqiconview.html#Arrangement-enum">arrangement in use</a>. See the <a href="#pixmap-size-limit">main class documentation</a> for details. <p> <p>See also <a href="#pixmap">pixmap</a>(). <h3 class=fn>void <a name="setPixmap-2"></a>TQIconViewItem::setPixmap ( const <a href="ntqpixmap.html">TQPixmap</a> & icon, bool recalc, bool redraw = TRUE )<tt> [virtual]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Sets <em>icon</em> as the item's icon in the icon view. If <em>recalc</em> is TRUE, the icon view's layout is recalculated. If <em>redraw</em> is TRUE (the default), the icon view is repainted. <p> <b>Note:</b> Pixmaps with individual dimensions larger than 300 pixels may not be displayed properly, depending on the <a href="ntqiconview.html#Arrangement-enum">arrangement in use</a>. See the <a href="#pixmap-size-limit">main class documentation</a> for details. <p> <p>See also <a href="#pixmap">pixmap</a>(). <h3 class=fn>void <a name="setPixmapRect"></a>TQIconViewItem::setPixmapRect ( const <a href="ntqrect.html">TQRect</a> & r )<tt> [protected]</tt> </h3> Sets the bounding rectangle of the item's icon to <em>r</em>. This function is provided for subclasses which reimplement <a href="#calcRect">calcRect</a>(), so that they can set the calculated rectangle. <em>Any other use is discouraged.</em> <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>(). <h3 class=fn>void <a name="setRenameEnabled"></a>TQIconViewItem::setRenameEnabled ( bool allow )<tt> [virtual]</tt> </h3> If <em>allow</em> is TRUE, the user can rename the icon view item by clicking on the text (or pressing F2) while the item is selected (in-place renaming). If <em>allow</em> is FALSE, in-place renaming is not possible. <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>. <h3 class=fn>void <a name="setSelectable"></a>TQIconViewItem::setSelectable ( bool enable )<tt> [virtual]</tt> </h3> Sets this item to be selectable if <em>enable</em> is TRUE (the default) or unselectable if <em>enable</em> is FALSE. <p> The user is unable to select a non-selectable item using either the keyboard or the mouse. (The application programmer can select an item in code regardless of this setting.) <p> <p>See also <a href="#isSelectable">isSelectable</a>(). <h3 class=fn>void <a name="setSelected"></a>TQIconViewItem::setSelected ( bool s, bool cb )<tt> [virtual]</tt> </h3> Selects or unselects the item, depending on <em>s</em>; it may also unselect other items, depending on <a href="ntqiconview.html#selectionMode">TQIconView::selectionMode</a>() and <em>cb</em>. <p> If <em>s</em> is FALSE, the item is unselected. <p> If <em>s</em> is TRUE and TQIconView::selectionMode() is <tt>Single</tt>, the item is selected and the item previously selected is unselected. <p> If <em>s</em> is TRUE and TQIconView::selectionMode() is <tt>Extended</tt>, the item is selected. If <em>cb</em> is TRUE, the selection state of the other items is left unchanged. If <em>cb</em> is FALSE (the default) all other items are unselected. <p> If <em>s</em> is TRUE and TQIconView::selectionMode() is <tt>Multi</tt>, the item is selected. <p> Note that <em>cb</em> is used only if TQIconView::selectionMode() is <tt>Extended</tt>; cb defaults to FALSE. <p> All items whose selection status changes repaint themselves. <p>Example: <a href="fileiconview-example.html#x849">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>void <a name="setSelected-2"></a>TQIconViewItem::setSelected ( bool s )<tt> [virtual]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> This variant is equivalent to calling the other variant with <em>cb</em> set to FALSE. <h3 class=fn>void <a name="setText"></a>TQIconViewItem::setText ( const <a href="ntqstring.html">TQString</a> & text )<tt> [virtual]</tt> </h3> Sets <em>text</em> as the text of the icon view item. This function might be a no-op if you reimplement <a href="#text">text</a>(). <p> <p>See also <a href="#text">text</a>(). <p>Example: <a href="fileiconview-example.html#x850">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>void <a name="setText-2"></a>TQIconViewItem::setText ( const <a href="ntqstring.html">TQString</a> & text, bool recalc, bool redraw = TRUE )<tt> [virtual]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Sets <em>text</em> as the text of the icon view item. If <em>recalc</em> is TRUE, the icon view's layout is recalculated. If <em>redraw</em> is TRUE (the default), the icon view is repainted. <p> <p>See also <a href="#text">text</a>(). <h3 class=fn>void <a name="setTextRect"></a>TQIconViewItem::setTextRect ( const <a href="ntqrect.html">TQRect</a> & r )<tt> [protected]</tt> </h3> Sets the bounding rectangle of the item's text to <em>r</em>. This function is provided for subclasses which reimplement <a href="#calcRect">calcRect</a>(), so that they can set the calculated rectangle. <em>Any other use is discouraged.</em> <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>(). <h3 class=fn><a href="ntqsize.html">TQSize</a> <a name="size"></a>TQIconViewItem::size () const </h3> Returns the size of the item. <h3 class=fn><a href="ntqstring.html">TQString</a> <a name="text"></a>TQIconViewItem::text () const<tt> [virtual]</tt> </h3> Returns the text of the icon view item. Normally you set the text of the item with <a href="#setText">setText</a>(), but sometimes it's inconvenient to call setText() for every item; so you can subclass TQIconViewItem, reimplement this function, and return the text of the item. If you do this, you must call <a href="#calcRect">calcRect</a>() manually each time the text (and therefore its size) changes. <p> <p>See also <a href="#setText">setText</a>(). <p>Example: <a href="fileiconview-example.html#x851">fileiconview/qfileiconview.cpp</a>. <h3 class=fn><a href="ntqrect.html">TQRect</a> <a name="textRect"></a>TQIconViewItem::textRect ( bool relative = TRUE ) const </h3> Returns the bounding rectangle of the item's text. <p> If <em>relative</em> is TRUE, (the default), the returned rectangle is relative to the origin of the item's rectangle. If <em>relative</em> is FALSE, the returned rectangle is relative to the origin of the icon view's contents coordinate system. <p>Example: <a href="fileiconview-example.html#x852">fileiconview/qfileiconview.cpp</a>. <h3 class=fn>int <a name="width"></a>TQIconViewItem::width () const </h3> Returns the width of the item. <h3 class=fn>int <a name="x"></a>TQIconViewItem::x () const </h3> Returns the x-coordinate of the item (in contents coordinates). <h3 class=fn>int <a name="y"></a>TQIconViewItem::y () const </h3> Returns the y-coordinate of the item (in contents coordinates). <!-- eof --> <hr><p> This file is part of the <a href="index.html">TQt toolkit</a>. Copyright © 1995-2007 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2007 <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> <td align=right><div align=right>TQt 3.3.8</div> </table></div></address></body> </html>