<!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:2261 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>TQIconView 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>TQIconView Class Reference<br><small>[<a href="iconview.html">iconview module</a>]</small></h1> <p>The TQIconView class provides an area with movable labelled icons. <a href="#details">More...</a> <p><tt>#include <<a href="qiconview-h.html">ntqiconview.h</a>></tt> <p>Inherits <a href="ntqscrollview.html">TQScrollView</a>. <p><a href="qiconview-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li class=fn>enum <a href="#SelectionMode-enum"><b>SelectionMode</b></a> { Single = 0, Multi, Extended, NoSelection }</li> <li class=fn>enum <a href="#Arrangement-enum"><b>Arrangement</b></a> { LeftToRight = 0, TopToBottom }</li> <li class=fn>enum <a href="#ResizeMode-enum"><b>ResizeMode</b></a> { Fixed = 0, Adjust }</li> <li class=fn>enum <a href="#ItemTextPos-enum"><b>ItemTextPos</b></a> { Bottom = 0, Right }</li> <li class=fn><a href="#TQIconView"><b>TQIconView</b></a> ( TQWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li> <li class=fn>virtual <a href="#~TQIconView"><b>~TQIconView</b></a> ()</li> <li class=fn>virtual void <a href="#insertItem"><b>insertItem</b></a> ( TQIconViewItem * item, TQIconViewItem * after = 0L )</li> <li class=fn>virtual void <a href="#takeItem"><b>takeItem</b></a> ( TQIconViewItem * item )</li> <li class=fn>int <a href="#index"><b>index</b></a> ( const TQIconViewItem * item ) const</li> <li class=fn>TQIconViewItem * <a href="#firstItem"><b>firstItem</b></a> () const</li> <li class=fn>TQIconViewItem * <a href="#lastItem"><b>lastItem</b></a> () const</li> <li class=fn>TQIconViewItem * <a href="#currentItem"><b>currentItem</b></a> () const</li> <li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( TQIconViewItem * item )</li> <li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( TQIconViewItem * item, bool s, bool cb = FALSE )</li> <li class=fn>uint <a href="#count"><b>count</b></a> () const</li> <li class=fn>virtual void <a href="#setSelectionMode"><b>setSelectionMode</b></a> ( SelectionMode m )</li> <li class=fn>SelectionMode <a href="#selectionMode"><b>selectionMode</b></a> () const</li> <li class=fn>TQIconViewItem * <a href="#findItem"><b>findItem</b></a> ( const TQPoint & pos ) const</li> <li class=fn>TQIconViewItem * <a href="#findItem-2"><b>findItem</b></a> ( const TQString & text, ComparisonFlags compare = BeginsWith ) const</li> <li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool select )</li> <li class=fn>virtual void <a href="#clearSelection"><b>clearSelection</b></a> ()</li> <li class=fn>virtual void <a href="#invertSelection"><b>invertSelection</b></a> ()</li> <li class=fn>virtual void <a href="#repaintItem"><b>repaintItem</b></a> ( TQIconViewItem * item )</li> <li class=fn>void <a href="#repaintSelectedItems"><b>repaintSelectedItems</b></a> ()</li> <li class=fn>void <a href="#ensureItemVisible"><b>ensureItemVisible</b></a> ( TQIconViewItem * item )</li> <li class=fn>TQIconViewItem * <a href="#findFirstVisibleItem"><b>findFirstVisibleItem</b></a> ( const TQRect & r ) const</li> <li class=fn>TQIconViewItem * <a href="#findLastVisibleItem"><b>findLastVisibleItem</b></a> ( const TQRect & r ) const</li> <li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li> <li class=fn>virtual void <a href="#setGridX"><b>setGridX</b></a> ( int rx )</li> <li class=fn>virtual void <a href="#setGridY"><b>setGridY</b></a> ( int ry )</li> <li class=fn>int <a href="#gridX"><b>gridX</b></a> () const</li> <li class=fn>int <a href="#gridY"><b>gridY</b></a> () const</li> <li class=fn>virtual void <a href="#setSpacing"><b>setSpacing</b></a> ( int sp )</li> <li class=fn>int <a href="#spacing"><b>spacing</b></a> () const</li> <li class=fn>virtual void <a href="#setItemTextPos"><b>setItemTextPos</b></a> ( ItemTextPos pos )</li> <li class=fn>ItemTextPos <a href="#itemTextPos"><b>itemTextPos</b></a> () const</li> <li class=fn>virtual void <a href="#setItemTextBackground"><b>setItemTextBackground</b></a> ( const TQBrush & b )</li> <li class=fn>TQBrush <a href="#itemTextBackground"><b>itemTextBackground</b></a> () const</li> <li class=fn>virtual void <a href="#setArrangement"><b>setArrangement</b></a> ( Arrangement am )</li> <li class=fn>Arrangement <a href="#arrangement"><b>arrangement</b></a> () const</li> <li class=fn>virtual void <a href="#setResizeMode"><b>setResizeMode</b></a> ( ResizeMode am )</li> <li class=fn>ResizeMode <a href="#resizeMode"><b>resizeMode</b></a> () const</li> <li class=fn>virtual void <a href="#setMaxItemWidth"><b>setMaxItemWidth</b></a> ( int w )</li> <li class=fn>int <a href="#maxItemWidth"><b>maxItemWidth</b></a> () const</li> <li class=fn>virtual void <a href="#setMaxItemTextLength"><b>setMaxItemTextLength</b></a> ( int w )</li> <li class=fn>int <a href="#maxItemTextLength"><b>maxItemTextLength</b></a> () const</li> <li class=fn>virtual void <a href="#setAutoArrange"><b>setAutoArrange</b></a> ( bool b )</li> <li class=fn>bool <a href="#autoArrange"><b>autoArrange</b></a> () const</li> <li class=fn>virtual void <a href="#setShowToolTips"><b>setShowToolTips</b></a> ( bool b )</li> <li class=fn>bool <a href="#showToolTips"><b>showToolTips</b></a> () const</li> <li class=fn>void <a href="#setSorting"><b>setSorting</b></a> ( bool sort, bool ascending = TRUE )</li> <li class=fn>bool <a href="#sorting"><b>sorting</b></a> () const</li> <li class=fn>bool <a href="#sortDirection"><b>sortDirection</b></a> () const</li> <li class=fn>virtual void <a href="#setItemsMovable"><b>setItemsMovable</b></a> ( bool b )</li> <li class=fn>bool <a href="#itemsMovable"><b>itemsMovable</b></a> () const</li> <li class=fn>virtual void <a href="#setWordWrapIconText"><b>setWordWrapIconText</b></a> ( bool b )</li> <li class=fn>bool <a href="#wordWrapIconText"><b>wordWrapIconText</b></a> () const</li> <li class=fn>virtual void <a href="#sort"><b>sort</b></a> ( bool ascending = TRUE )</li> <li class=fn>bool <a href="#isRenaming"><b>isRenaming</b></a> () const</li> </ul> <h2>Public Slots</h2> <ul> <li class=fn>virtual void <a href="#arrangeItemsInGrid"><b>arrangeItemsInGrid</b></a> ( const TQSize & grid, bool update = TRUE )</li> <li class=fn>virtual void <a href="#arrangeItemsInGrid-2"><b>arrangeItemsInGrid</b></a> ( bool update = TRUE )</li> </ul> <h2>Signals</h2> <ul> <li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li> <li class=fn>void <a href="#selectionChanged-2"><b>selectionChanged</b></a> ( TQIconViewItem * item )</li> <li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( TQIconViewItem * item )</li> <li class=fn>void <a href="#clicked"><b>clicked</b></a> ( TQIconViewItem * item )</li> <li class=fn>void <a href="#clicked-2"><b>clicked</b></a> ( TQIconViewItem * item, const TQPoint & pos )</li> <li class=fn>void <a href="#pressed"><b>pressed</b></a> ( TQIconViewItem * item )</li> <li class=fn>void <a href="#pressed-2"><b>pressed</b></a> ( TQIconViewItem * item, const TQPoint & pos )</li> <li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( TQIconViewItem * item )</li> <li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ( TQIconViewItem * item )</li> <li class=fn>void <a href="#rightButtonClicked"><b>rightButtonClicked</b></a> ( TQIconViewItem * item, const TQPoint & pos )</li> <li class=fn>void <a href="#rightButtonPressed"><b>rightButtonPressed</b></a> ( TQIconViewItem * item, const TQPoint & pos )</li> <li class=fn>void <a href="#mouseButtonPressed"><b>mouseButtonPressed</b></a> ( int button, TQIconViewItem * item, const TQPoint & pos )</li> <li class=fn>void <a href="#mouseButtonClicked"><b>mouseButtonClicked</b></a> ( int button, TQIconViewItem * item, const TQPoint & pos )</li> <li class=fn>void <a href="#contextMenuRequested"><b>contextMenuRequested</b></a> ( TQIconViewItem * item, const TQPoint & pos )</li> <li class=fn>void <a href="#dropped"><b>dropped</b></a> ( TQDropEvent * e, const TQValueList<TQIconDragItem> & lst )</li> <li class=fn>void <a href="#moved"><b>moved</b></a> ()</li> <li class=fn>void <a href="#onItem"><b>onItem</b></a> ( TQIconViewItem * item )</li> <li class=fn>void <a href="#onViewport"><b>onViewport</b></a> ()</li> <li class=fn>void <a href="#itemRenamed"><b>itemRenamed</b></a> ( TQIconViewItem * item, const TQString & name )</li> <li class=fn>void <a href="#itemRenamed-2"><b>itemRenamed</b></a> ( TQIconViewItem * item )</li> </ul> <h2>Properties</h2> <ul> <li class=fn>Arrangement <a href="#arrangement-prop"><b>arrangement</b></a> - the arrangement mode of the icon view</li> <li class=fn>bool <a href="#autoArrange-prop"><b>autoArrange</b></a> - whether the icon view rearranges its items when a new item is inserted</li> <li class=fn>uint <a href="#count-prop"><b>count</b></a> - the number of items in the icon view <em>(read only)</em></li> <li class=fn>int <a href="#gridX-prop"><b>gridX</b></a> - the horizontal grid of the icon view</li> <li class=fn>int <a href="#gridY-prop"><b>gridY</b></a> - the vertical grid of the icon view</li> <li class=fn>TQBrush <a href="#itemTextBackground-prop"><b>itemTextBackground</b></a> - the brush to use when drawing the background of an item's text</li> <li class=fn>ItemTextPos <a href="#itemTextPos-prop"><b>itemTextPos</b></a> - the position where the text of each item is drawn</li> <li class=fn>bool <a href="#itemsMovable-prop"><b>itemsMovable</b></a> - whether the user is allowed to move items around in the icon view</li> <li class=fn>int <a href="#maxItemTextLength-prop"><b>maxItemTextLength</b></a> - the maximum length (in characters) that an item's text may have</li> <li class=fn>int <a href="#maxItemWidth-prop"><b>maxItemWidth</b></a> - the maximum width that an item may have</li> <li class=fn>ResizeMode <a href="#resizeMode-prop"><b>resizeMode</b></a> - the resize mode of the icon view</li> <li class=fn>SelectionMode <a href="#selectionMode-prop"><b>selectionMode</b></a> - the selection mode of the icon view</li> <li class=fn>bool <a href="#showToolTips-prop"><b>showToolTips</b></a> - whether the icon view will display a tool tip with the complete text for any truncated item text</li> <li class=fn>bool <a href="#sortDirection-prop"><b>sortDirection</b></a> - whether the sort direction for inserting new items is ascending; <em>(read only)</em></li> <li class=fn>bool <a href="#sorting-prop"><b>sorting</b></a> - whether the icon view sorts on insertion <em>(read only)</em></li> <li class=fn>int <a href="#spacing-prop"><b>spacing</b></a> - the space in pixels between icon view items</li> <li class=fn>bool <a href="#wordWrapIconText-prop"><b>wordWrapIconText</b></a> - whether the item text will be word-wrapped if it is too long</li> </ul> <h2>Protected Members</h2> <ul> <li class=fn>virtual void <a href="#drawRubber"><b>drawRubber</b></a> ( TQPainter * p )</li> <li class=fn>virtual TQDragObject * <a href="#dragObject"><b>dragObject</b></a> ()</li> <li class=fn>virtual void <a href="#startDrag"><b>startDrag</b></a> ()</li> <li class=fn>virtual void <a href="#insertInGrid"><b>insertInGrid</b></a> ( TQIconViewItem * item )</li> <li class=fn>virtual void <a href="#drawBackground"><b>drawBackground</b></a> ( TQPainter * p, const TQRect & r )</li> <li class=fn>void <a href="#emitSelectionChanged"><b>emitSelectionChanged</b></a> ( TQIconViewItem * i = 0 )</li> <li class=fn>TQIconViewItem * <a href="#makeRowLayout"><b>makeRowLayout</b></a> ( TQIconViewItem * begin, int & y, bool & changed )</li> </ul> <h2>Protected Slots</h2> <ul> <li class=fn>virtual void <a href="#doAutoScroll"><b>doAutoScroll</b></a> ()</li> <li class=fn>virtual void <a href="#adjustItems"><b>adjustItems</b></a> ()</li> <li class=fn>virtual void <a href="#slotUpdate"><b>slotUpdate</b></a> ()</li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The TQIconView class provides an area with movable labelled icons. <p> <p> A TQIconView can display and manage a grid or other 2D layout of labelled icons. Each labelled icon is a <a href="qiconviewitem.html">TQIconViewItem</a>. Items (TQIconViewItems) can be added or deleted at any time; items can be moved within the TQIconView. Single or multiple items can be selected. Items can be renamed in-place. TQIconView also supports <a href="#draganddrop">drag and drop</a>. <p> Each item contains a label string, a pixmap or picture (the icon itself) and optionally a sort key. The sort key is used for sorting the items and defaults to the label string. The label string can be displayed below or to the right of the icon (see <a href="#ItemTextPos-enum">ItemTextPos</a>). <p> The simplest way to create a TQIconView is to create a TQIconView object and create some TQIconViewItems with the TQIconView as their parent, set the icon view's geometry and show it. For example: <pre> TQIconView *iv = new TQIconView( this ); <a href="ntqdir.html">TQDir</a> dir( path, "*.xpm" ); for ( uint i = 0; i < dir.<a href="ntqdir.html#count">count</a>(); i++ ) { (void) new <a href="qiconviewitem.html">TQIconViewItem</a>( iv, dir[i], TQPixmap( path + dir[i] ) ); } iv-><a href="ntqwidget.html#resize">resize</a>( 600, 400 ); iv-><a href="ntqwidget.html#show">show</a>(); </pre> <p> The <a href="qiconviewitem.html">TQIconViewItem</a> call passes a pointer to the TQIconView we wish to populate, along with the label text and a <a href="ntqpixmap.html">TQPixmap</a>. <p> When an item is inserted the TQIconView allocates a position for it. Existing items are rearranged if <a href="#autoArrange">autoArrange</a>() is TRUE. The default arrangement is <a href="#Arrangement-enum">LeftToRight</a> -- the TQIconView fills up the <em>left-most</em> column from top to bottom, then moves one column <em>right</em> and fills that from top to bottom and so on. The arrangement can be modified with any of the following approaches: <ul> <li> Call <a href="#setArrangement">setArrangement</a>(), e.g. with <a href="#Arrangement-enum">TopToBottom</a> which will fill the <em>top-most</em> row from left to right, then moves one row <em>down</em> and fills that row from left to right and so on. <li> Construct each TQIconViewItem using a constructor which allows you to specify which item the new one is to follow. <li> Call <a href="#setSorting">setSorting</a>() or <a href="#sort">sort</a>() to sort the items. </ul> <p> The spacing between items is set with <a href="#setSpacing">setSpacing</a>(). Items can be laid out using a fixed grid using <a href="#setGridX">setGridX</a>() and <a href="#setGridY">setGridY</a>(); by default the TQIconView calculates a grid dynamically. The position of items' label text is set with <a href="#setItemTextPos">setItemTextPos</a>(). The text's background can be set with <a href="#setItemTextBackground">setItemTextBackground</a>(). The maximum width of an item and of its text are set with <a href="#setMaxItemWidth">setMaxItemWidth</a>() and <a href="#setMaxItemTextLength">setMaxItemTextLength</a>(). The label text will be word-wrapped if it is too long; this is controlled by <a href="#setWordWrapIconText">setWordWrapIconText</a>(). If the label text is truncated, the user can still see the entire text in a tool tip if they hover the mouse over the item. This is controlled with <a href="#setShowToolTips">setShowToolTips</a>(). <p> Items which are <a href="qiconviewitem.html#isSelectable">selectable</a> may be selected depending on the SelectionMode; the default is <a href="#SelectionMode-enum">Single</a>. Because TQIconView offers multiple selection it must display <a href="focus.html#keyboard-focus">keyboard focus</a> and selection state separately. Therefore there are functions to set the selection state of an item (<a href="#setSelected">setSelected</a>()) and to select which item displays keyboard focus (<a href="#setCurrentItem">setCurrentItem</a>()). When multiple items may be selected the icon view provides a rubberband, too. <p> When in-place renaming is enabled (it is disabled by default), the user may change the item's label. They do this by selecting the item (single clicking it or navigating to it with the arrow keys), then single clicking it (or pressing F2), and entering their text. If no key has been set with <a href="qiconviewitem.html#setKey">TQIconViewItem::setKey</a>() the new text will also serve as the key. (See <a href="qiconviewitem.html#setRenameEnabled">TQIconViewItem::setRenameEnabled</a>().) <p> You can control whether users can move items themselves with <a href="#setItemsMovable">setItemsMovable</a>(). <p> Because the internal structure used to store the icon view items is linear, no iterator class is needed to iterate over all the items. Instead we iterate by getting the first item from the <em>icon view</em> and then each subsequent (<a href="qiconviewitem.html#nextItem">TQIconViewItem::nextItem</a>()) from each <em>item</em> in turn: <pre> for ( <a href="qiconviewitem.html">TQIconViewItem</a> *item = iv->firstItem(); item; item = item-><a href="qiconviewitem.html#nextItem">nextItem</a>() ) do_something( item ); </pre> TQIconView also provides <a href="#currentItem">currentItem</a>(). You can search for an item using <a href="#findItem">findItem</a>() (searching by position or for label text) and with <a href="#findFirstVisibleItem">findFirstVisibleItem</a>() and <a href="#findLastVisibleItem">findLastVisibleItem</a>(). The number of items is returned by <a href="#count">count</a>(). An item can be removed from an icon view using <a href="#takeItem">takeItem</a>(); to delete an item use <tt>delete</tt>. All the items can be deleted with <a href="#clear">clear</a>(). <p> The TQIconView emits a wide range of useful signals, including <a href="#selectionChanged">selectionChanged</a>(), <a href="#currentChanged">currentChanged</a>(), <a href="#clicked">clicked</a>(), <a href="#moved">moved</a>() and <a href="#itemRenamed">itemRenamed</a>(). <p> <a name="draganddrop"></a> <h3> Drag and Drop </h3> <a name="1"></a><p> TQIconView supports the drag and drop of items within the TQIconView itself. It also supports the drag and drop of items out of or into the TQIconView and drag and drop onto items themselves. The drag and drop of items outside the TQIconView can be achieved in a simple way with basic functionality, or in a more sophisticated way which provides more power and control. <p> The simple approach to dragging items out of the icon view is to subclass TQIconView and reimplement <a href="#dragObject">TQIconView::dragObject</a>(). <p> <pre> TQDragObject *MyIconView::dragObject() { return new <a href="qtextdrag.html">TQTextDrag</a>( <a href="#currentItem">currentItem</a>()->text(), this ); } </pre> <p> In this example we create a <a href="qtextdrag.html">TQTextDrag</a> object, (derived from <a href="ntqdragobject.html">TQDragObject</a>), containing the item's label and return it as the drag object. We could just as easily have created a <a href="qimagedrag.html">TQImageDrag</a> from the item's pixmap and returned that instead. <p> TQIconViews and their TQIconViewItems can also be the targets of drag and drops. To make the TQIconView itself able to accept drops connect to the <a href="#dropped">dropped</a>() signal. When a drop occurs this signal will be emitted with a TQDragEvent and a <a href="ntqvaluelist.html">TQValueList</a> of TQIconDragItems. To make a <a href="qiconviewitem.html">TQIconViewItem</a> into a drop target subclass TQIconViewItem and reimplement <a href="qiconviewitem.html#acceptDrop">TQIconViewItem::acceptDrop</a>() and <a href="qiconviewitem.html#dropped">TQIconViewItem::dropped</a>(). <p> <pre> bool MyIconViewItem::acceptDrop( const <a href="qmimesource.html">TQMimeSource</a> *mime ) const { if ( mime-><a href="qmimesource.html#provides">provides</a>( "text/plain" ) ) return TRUE; return FALSE; } void MyIconViewItem::dropped( <a href="qdropevent.html">TQDropEvent</a> *evt, const <a href="ntqvaluelist.html">TQValueList</a><TQIconDragItem>& ) { <a href="ntqstring.html">TQString</a> label; if ( TQTextDrag::<a href="qtextdrag.html#decode">decode</a>( evt, label ) ) setText( label ); } </pre> <p> See <a href="iconview-simple_dd-main-h.html">iconview/simple_dd/main.h</a> and <a href="iconview-simple_dd-main-cpp.html">iconview/simple_dd/main.cpp</a> for a simple drag and drop example which demonstrates drag and drop between a TQIconView and a <a href="ntqlistbox.html">TQListBox</a>. <p> If you want to use extended drag-and-drop or have drag shapes drawn you must take a more sophisticated approach. <p> The first part is starting drags -- you should use a <a href="qicondrag.html">TQIconDrag</a> (or a class derived from it) for the drag object. In <a href="#dragObject">dragObject</a>() create the drag object, populate it with TQIconDragItems and return it. Normally such a drag should offer each selected item's data. So in dragObject() you should iterate over all the items, and create a <a href="qicondragitem.html">TQIconDragItem</a> for each selected item, and append these items with <a href="qicondrag.html#append">TQIconDrag::append</a>() to the TQIconDrag object. You can use <a href="qicondragitem.html#setData">TQIconDragItem::setData</a>() to set the data of each item that should be dragged. If you want to offer the data in additional mime-types, it's best to use a class derived from TQIconDrag, which implements additional encoding and decoding functions. <p> When a drag enters the icon view, there is little to do. Simply connect to the <a href="#dropped">dropped</a>() signal and reimplement <a href="qiconviewitem.html#acceptDrop">TQIconViewItem::acceptDrop</a>() and <a href="qiconviewitem.html#dropped">TQIconViewItem::dropped</a>(). If you've used a <a href="qicondrag.html">TQIconDrag</a> (or a subclass of it) the second argument to the dropped signal contains a <a href="ntqvaluelist.html">TQValueList</a> of TQIconDragItems -- you can access their data by calling <a href="qicondragitem.html#data">TQIconDragItem::data</a>() on each one. <p> For an example implementation of complex drag-and-drop look at the fileiconview example (qt/examples/fileiconview). <p> <p>See also <a href="qiconviewitem.html#setDragEnabled">TQIconViewItem::setDragEnabled</a>(), <a href="qiconviewitem.html#setDropEnabled">TQIconViewItem::setDropEnabled</a>(), <a href="qiconviewitem.html#acceptDrop">TQIconViewItem::acceptDrop</a>(), <a href="qiconviewitem.html#dropped">TQIconViewItem::dropped</a>(), and <a href="advanced.html">Advanced Widgets</a>. <p> <img src=qiconview-m.png> <img src=qiconview-w.png> <hr><h2>Member Type Documentation</h2> <h3 class=fn><a name="Arrangement-enum"></a>TQIconView::Arrangement</h3> <p> This enum type determines in which direction the items flow when the view runs out of space. <ul> <li><tt>TQIconView::LeftToRight</tt> - Items which don't fit into the view cause the viewport to extend vertically (you get a vertical scrollbar). <li><tt>TQIconView::TopToBottom</tt> - Items which don't fit into the view cause the viewport to extend horizontally (you get a horizontal scrollbar). </ul> <h3 class=fn><a name="ItemTextPos-enum"></a>TQIconView::ItemTextPos</h3> <p> This enum type specifies the position of the item text in relation to the icon. <ul> <li><tt>TQIconView::Bottom</tt> - The text is drawn below the icon. <li><tt>TQIconView::Right</tt> - The text is drawn to the right of the icon. </ul> <h3 class=fn><a name="ResizeMode-enum"></a>TQIconView::ResizeMode</h3> <p> This enum type is used to tell TQIconView how it should treat the positions of its icons when the widget is resized. The modes are: <ul> <li><tt>TQIconView::Fixed</tt> - The icons' positions are not changed. <li><tt>TQIconView::Adjust</tt> - The icons' positions are adjusted to be within the new geometry, if possible. </ul> <h3 class=fn><a name="SelectionMode-enum"></a>TQIconView::SelectionMode</h3> <p> This enumerated type is used by TQIconView to indicate how it reacts to selection by the user. It has four values: <ul> <li><tt>TQIconView::Single</tt> - When the user selects an item, any already-selected item becomes unselected and the user cannot unselect the selected item. This means that the user can never clear the selection. (The application programmer can, using <a href="#clearSelection">TQIconView::clearSelection</a>().) <li><tt>TQIconView::Multi</tt> - When the user selects an item, e.g. by navigating to it with the keyboard arrow keys or by clicking it, the selection status of that item is toggled and the other items are left alone. Also, multiple items can be selected by dragging the mouse while the left mouse button stays pressed. <li><tt>TQIconView::Extended</tt> - When the user selects an item the selection is cleared and the new item selected. However, if the user presses the Ctrl key when clicking on an item, the clicked item gets toggled and all other items are left untouched. If the user presses the Shift key while clicking on an item, all items between the current item and the clicked item get selected or unselected, depending on the state of the clicked item. Also, multiple items can be selected by dragging the mouse while the left mouse button stays pressed. <li><tt>TQIconView::NoSelection</tt> - Items cannot be selected. </ul><p> To summarise: <a href="#SelectionMode-enum">Single</a> is a real single-selection icon view; <a href="#SelectionMode-enum">Multi</a> a real multi-selection icon view; <a href="#SelectionMode-enum">Extended</a> is an icon view in which users can select multiple items but usually want to select either just one or a range of contiguous items; and <a href="#SelectionMode-enum">NoSelection</a> mode is for an icon view where the user can look but not touch. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="TQIconView"></a>TQIconView::TQIconView ( <a href="ntqwidget.html">TQWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 ) </h3> Constructs an empty icon view called <em>name</em>, with parent <em>parent</em> and using the widget flags <em>f</em>. <h3 class=fn><a name="~TQIconView"></a>TQIconView::~TQIconView ()<tt> [virtual]</tt> </h3> Destroys the icon view and deletes all items. <h3 class=fn>void <a name="adjustItems"></a>TQIconView::adjustItems ()<tt> [virtual protected slot]</tt> </h3> Adjusts the positions of the items to the geometry of the icon view. <h3 class=fn>void <a name="arrangeItemsInGrid"></a>TQIconView::arrangeItemsInGrid ( const <a href="ntqsize.html">TQSize</a> & grid, bool update = TRUE )<tt> [virtual slot]</tt> </h3> This variant uses <em>grid</em> instead of (<a href="#gridX">gridX</a>(), <a href="#gridY">gridY</a>()). If <em>grid</em> is invalid (see <a href="ntqsize.html#isValid">TQSize::isValid</a>()), <a href="#arrangeItemsInGrid">arrangeItemsInGrid</a>() calculates a valid grid itself and uses that. <p> If <em>update</em> is TRUE (the default) the viewport is repainted. <p>Example: <a href="fileiconview-example.html#x807">fileiconview/qfileiconview.h</a>. <h3 class=fn>void <a name="arrangeItemsInGrid-2"></a>TQIconView::arrangeItemsInGrid ( bool update = TRUE )<tt> [virtual slot]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Arranges all the items in the grid given by <a href="#gridX">gridX</a>() and <a href="#gridY">gridY</a>(). <p> Even if <a href="#sorting">sorting</a>() is enabled, the items are not sorted by this function. If you want to sort or rearrange the items, use iconview->sort(iconview->sortDirection()). <p> If <em>update</em> is TRUE (the default), the viewport is repainted as well. <p> <p>See also <a href="#gridX-prop">TQIconView::gridX</a>, <a href="#gridY-prop">TQIconView::gridY</a>, and <a href="#sort">TQIconView::sort</a>(). <h3 class=fn><a href="ntqiconview.html#Arrangement-enum">Arrangement</a> <a name="arrangement"></a>TQIconView::arrangement () const </h3><p>Returns the arrangement mode of the icon view. See the <a href="ntqiconview.html#arrangement-prop">"arrangement"</a> property for details. <h3 class=fn>bool <a name="autoArrange"></a>TQIconView::autoArrange () const </h3><p>Returns TRUE if the icon view rearranges its items when a new item is inserted; otherwise returns FALSE. See the <a href="ntqiconview.html#autoArrange-prop">"autoArrange"</a> property for details. <h3 class=fn>void <a name="clear"></a>TQIconView::clear ()<tt> [virtual]</tt> </h3> Clears the icon view. All items are deleted. <h3 class=fn>void <a name="clearSelection"></a>TQIconView::clearSelection ()<tt> [virtual]</tt> </h3> Unselects all the items. <h3 class=fn>void <a name="clicked"></a>TQIconView::clicked ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user clicks any mouse button. If <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null, the mouse cursor isn't on any item. <p> <p>See also <a href="#mouseButtonClicked">mouseButtonClicked</a>(), <a href="#rightButtonClicked">rightButtonClicked</a>(), and <a href="#pressed">pressed</a>(). <h3 class=fn>void <a name="clicked-2"></a>TQIconView::clicked ( <a href="qiconviewitem.html">TQIconViewItem</a> * item, const <a href="ntqpoint.html">TQPoint</a> & pos )<tt> [signal]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> This signal is emitted when the user clicks any mouse button on an icon view item. <em>item</em> is a pointer to the item that has been clicked. <p> <em>pos</em> is the position of the mouse cursor in the global coordinate system (<a href="qmouseevent.html#globalPos">TQMouseEvent::globalPos</a>()). (If the click's press and release differ by a pixel or two, <em>pos</em> is the position at release time.) <p> <p>See also <a href="#mouseButtonClicked">mouseButtonClicked</a>(), <a href="#rightButtonClicked">rightButtonClicked</a>(), and <a href="#pressed">pressed</a>(). <h3 class=fn>void <a name="contextMenuRequested"></a>TQIconView::contextMenuRequested ( <a href="qiconviewitem.html">TQIconViewItem</a> * item, const <a href="ntqpoint.html">TQPoint</a> & pos )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user invokes a context menu with the right mouse button or with special system keys, with <em>item</em> being the item under the mouse cursor or the current item, respectively. <p> <em>pos</em> is the position for the context menu in the global coordinate system. <h3 class=fn>uint <a name="count"></a>TQIconView::count () const </h3><p>Returns the number of items in the icon view. See the <a href="ntqiconview.html#count-prop">"count"</a> property for details. <h3 class=fn>void <a name="currentChanged"></a>TQIconView::currentChanged ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [signal]</tt> </h3> <p> This signal is emitted when a new item becomes current. <em>item</em> is the new current item (or 0 if no item is now current). <p> <p>See also <a href="#currentItem">currentItem</a>(). <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="currentItem"></a>TQIconView::currentItem () const </h3> Returns a pointer to the current item of the icon view, or 0 if no item is current. <p> <p>See also <a href="#setCurrentItem">setCurrentItem</a>(), <a href="#firstItem">firstItem</a>(), and <a href="#lastItem">lastItem</a>(). <h3 class=fn>void <a name="doAutoScroll"></a>TQIconView::doAutoScroll ()<tt> [virtual protected slot]</tt> </h3> Performs autoscrolling when selecting multiple icons with the rubber band. <h3 class=fn>void <a name="doubleClicked"></a>TQIconView::doubleClicked ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user double-clicks on <em>item</em>. <h3 class=fn><a href="ntqdragobject.html">TQDragObject</a> * <a name="dragObject"></a>TQIconView::dragObject ()<tt> [virtual protected]</tt> </h3> Returns the <a href="ntqdragobject.html">TQDragObject</a> that should be used for drag-and-drop. This function is called by the icon view when starting a drag to get the dragobject that should be used for the drag. Subclasses may reimplement this. <p> <p>See also <a href="qicondrag.html">TQIconDrag</a>. <p>Examples: <a href="fileiconview-example.html#x834">fileiconview/qfileiconview.cpp</a> and <a href="simple_dd-example.html#x2820">iconview/simple_dd/main.cpp</a>. <h3 class=fn>void <a name="drawBackground"></a>TQIconView::drawBackground ( <a href="ntqpainter.html">TQPainter</a> * p, const <a href="ntqrect.html">TQRect</a> & r )<tt> [virtual protected]</tt> </h3> This function is called to draw the rectangle <em>r</em> of the background using the painter <em>p</em>. <p> The default implementation fills <em>r</em> with the viewport's <a href="ntqwidget.html#backgroundBrush">backgroundBrush</a>(). Subclasses may reimplement this to draw custom backgrounds. <p> <p>See also <a href="ntqscrollview.html#contentsX-prop">contentsX</a>, <a href="ntqscrollview.html#contentsY-prop">contentsY</a>, and <a href="ntqscrollview.html#drawContents">drawContents</a>(). <h3 class=fn>void <a name="drawRubber"></a>TQIconView::drawRubber ( <a href="ntqpainter.html">TQPainter</a> * p )<tt> [virtual protected]</tt> </h3> Draws the rubber band using the painter <em>p</em>. <h3 class=fn>void <a name="dropped"></a>TQIconView::dropped ( <a href="qdropevent.html">TQDropEvent</a> * e, const <a href="ntqvaluelist.html">TQValueList</a><TQIconDragItem> & lst )<tt> [signal]</tt> </h3> <p> This signal is emitted when a drop event occurs in the viewport (but not on any icon) which the icon view itself can't handle. <p> <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 using <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 have to decode the data in <em>e</em> and work with that. <p> Note TQIconViewItems may be drop targets; if a drop event occurs on an item the item handles the drop. <p>Examples: <a href="iconview-example.html#x1455">iconview/main.cpp</a> and <a href="simple_dd-example.html#x2821">iconview/simple_dd/main.cpp</a>. <h3 class=fn>void <a name="emitSelectionChanged"></a>TQIconView::emitSelectionChanged ( <a href="qiconviewitem.html">TQIconViewItem</a> * i = 0 )<tt> [protected]</tt> </h3> Emits a signal to indicate selection changes. <em>i</em> is the <a href="qiconviewitem.html">TQIconViewItem</a> that was selected or de-selected. <p> <em>You should never need to call this function.</em> <h3 class=fn>void <a name="ensureItemVisible"></a>TQIconView::ensureItemVisible ( <a href="qiconviewitem.html">TQIconViewItem</a> * item ) </h3> Makes sure that <em>item</em> is entirely visible. If necessary, <a href="#ensureItemVisible">ensureItemVisible</a>() scrolls the icon view. <p> <p>See also <a href="ntqscrollview.html#ensureVisible">ensureVisible</a>(). <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="findFirstVisibleItem"></a>TQIconView::findFirstVisibleItem ( const <a href="ntqrect.html">TQRect</a> & r ) const </h3> Finds the first item whose bounding rectangle overlaps <em>r</em> and returns a pointer to that item. <em>r</em> is given in content coordinates. Returns 0 if no item overlaps <em>r</em>. <p> If you want to find all items that touch <em>r</em>, you will need to use this function and nextItem() in a loop ending at <a href="#findLastVisibleItem">findLastVisibleItem</a>() and test <a href="qiconviewitem.html#rect">TQIconViewItem::rect</a>() for each of these items. <p> <p>See also <a href="#findLastVisibleItem">findLastVisibleItem</a>() and <a href="qiconviewitem.html#rect">TQIconViewItem::rect</a>(). <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="findItem"></a>TQIconView::findItem ( const <a href="ntqpoint.html">TQPoint</a> & pos ) const </h3> Returns a pointer to the item that contains point <em>pos</em>, which is given in contents coordinates, or 0 if no item contains point <em>pos</em>. <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="findItem-2"></a>TQIconView::findItem ( const <a href="ntqstring.html">TQString</a> & text, ComparisonFlags compare = BeginsWith ) const </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Returns a pointer to the first item whose text begins with <em>text</em>, or 0 if no such item could be found. Use the <em>compare</em> flag to control the comparison behaviour. (See <a href="ntqt.html#StringComparisonMode-enum">TQt::StringComparisonMode</a>.) <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="findLastVisibleItem"></a>TQIconView::findLastVisibleItem ( const <a href="ntqrect.html">TQRect</a> & r ) const </h3> Finds the last item whose bounding rectangle overlaps <em>r</em> and returns a pointer to that item. <em>r</em> is given in content coordinates. Returns 0 if no item overlaps <em>r</em>. <p> <p>See also <a href="#findFirstVisibleItem">findFirstVisibleItem</a>(). <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="firstItem"></a>TQIconView::firstItem () const </h3> Returns a pointer to the first item of the icon view, or 0 if there are no items in the icon view. <p> <p>See also <a href="#lastItem">lastItem</a>() and <a href="#currentItem">currentItem</a>(). <h3 class=fn>int <a name="gridX"></a>TQIconView::gridX () const </h3><p>Returns the horizontal grid of the icon view. See the <a href="ntqiconview.html#gridX-prop">"gridX"</a> property for details. <h3 class=fn>int <a name="gridY"></a>TQIconView::gridY () const </h3><p>Returns the vertical grid of the icon view. See the <a href="ntqiconview.html#gridY-prop">"gridY"</a> property for details. <h3 class=fn>int <a name="index"></a>TQIconView::index ( const <a href="qiconviewitem.html">TQIconViewItem</a> * item ) const </h3> Returns the index of <em>item</em>, or -1 if <em>item</em> doesn't exist in this icon view. <h3 class=fn>void <a name="insertInGrid"></a>TQIconView::insertInGrid ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [virtual protected]</tt> </h3> Inserts the <a href="qiconviewitem.html">TQIconViewItem</a> <em>item</em> in the icon view's grid. <em>You should never need to call this function.</em> Instead, insert TQIconViewItems by creating them with a pointer to the TQIconView that they are to be inserted into. <h3 class=fn>void <a name="insertItem"></a>TQIconView::insertItem ( <a href="qiconviewitem.html">TQIconViewItem</a> * item, <a href="qiconviewitem.html">TQIconViewItem</a> * after = 0L )<tt> [virtual]</tt> </h3> Inserts the icon view item <em>item</em> after <em>after</em>. If <em>after</em> is 0, <em>item</em> is appended after the last item. <p> <em>You should never need to call this function.</em> Instead create <a href="qiconviewitem.html">TQIconViewItem</a>'s and associate them with your icon view like this: <p> <pre> (void) new <a href="qiconviewitem.html">TQIconViewItem</a>( myIconview, "The text of the item", aPixmap ); </pre> <h3 class=fn>void <a name="invertSelection"></a>TQIconView::invertSelection ()<tt> [virtual]</tt> </h3> Inverts the selection. Works only in Multi and Extended selection mode. <h3 class=fn>bool <a name="isRenaming"></a>TQIconView::isRenaming () const </h3> Returns TRUE if an iconview item is being renamed; otherwise returns FALSE. <h3 class=fn>void <a name="itemRenamed"></a>TQIconView::itemRenamed ( <a href="qiconviewitem.html">TQIconViewItem</a> * item, const <a href="ntqstring.html">TQString</a> & name )<tt> [signal]</tt> </h3> <p> This signal is emitted when <em>item</em> has been renamed to <em>name</em>, usually by in-place renaming. <p> <p>See also <a href="qiconviewitem.html#setRenameEnabled">TQIconViewItem::setRenameEnabled</a>() and <a href="qiconviewitem.html#rename">TQIconViewItem::rename</a>(). <h3 class=fn>void <a name="itemRenamed-2"></a>TQIconView::itemRenamed ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [signal]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> This signal is emitted when <em>item</em> has been renamed, usually by in-place renaming. <p> <p>See also <a href="qiconviewitem.html#setRenameEnabled">TQIconViewItem::setRenameEnabled</a>() and <a href="qiconviewitem.html#rename">TQIconViewItem::rename</a>(). <h3 class=fn><a href="ntqbrush.html">TQBrush</a> <a name="itemTextBackground"></a>TQIconView::itemTextBackground () const </h3><p>Returns the brush to use when drawing the background of an item's text. See the <a href="ntqiconview.html#itemTextBackground-prop">"itemTextBackground"</a> property for details. <h3 class=fn><a href="ntqiconview.html#ItemTextPos-enum">ItemTextPos</a> <a name="itemTextPos"></a>TQIconView::itemTextPos () const </h3><p>Returns the position where the text of each item is drawn. See the <a href="ntqiconview.html#itemTextPos-prop">"itemTextPos"</a> property for details. <h3 class=fn>bool <a name="itemsMovable"></a>TQIconView::itemsMovable () const </h3><p>Returns TRUE if the user is allowed to move items around in the icon view; otherwise returns FALSE. See the <a href="ntqiconview.html#itemsMovable-prop">"itemsMovable"</a> property for details. <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="lastItem"></a>TQIconView::lastItem () const </h3> Returns a pointer to the last item of the icon view, or 0 if there are no items in the icon view. <p> <p>See also <a href="#firstItem">firstItem</a>() and <a href="#currentItem">currentItem</a>(). <h3 class=fn><a href="qiconviewitem.html">TQIconViewItem</a> * <a name="makeRowLayout"></a>TQIconView::makeRowLayout ( <a href="qiconviewitem.html">TQIconViewItem</a> * begin, int & y, bool & changed )<tt> [protected]</tt> </h3> Lays out a row of icons (if Arrangement == <a href="#Arrangement-enum">TopToBottom</a> this is a column). Starts laying out with the item <em>begin</em>. <em>y</em> is the starting coordinate. Returns the last item of the row (column) and sets the new starting coordinate to <em>y</em>. The <em>changed</em> parameter is used internally. <p> <b>Warning:</b> This function may be made private in a future version of TQt. We do not recommend calling it. <h3 class=fn>int <a name="maxItemTextLength"></a>TQIconView::maxItemTextLength () const </h3><p>Returns the maximum length (in characters) that an item's text may have. See the <a href="ntqiconview.html#maxItemTextLength-prop">"maxItemTextLength"</a> property for details. <h3 class=fn>int <a name="maxItemWidth"></a>TQIconView::maxItemWidth () const </h3><p>Returns the maximum width that an item may have. See the <a href="ntqiconview.html#maxItemWidth-prop">"maxItemWidth"</a> property for details. <h3 class=fn>void <a name="mouseButtonClicked"></a>TQIconView::mouseButtonClicked ( int button, <a href="qiconviewitem.html">TQIconViewItem</a> * item, const <a href="ntqpoint.html">TQPoint</a> & pos )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user clicks mouse button <em>button</em>. If <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null, the mouse cursor isn't on any item. <p> <em>pos</em> is the position of the mouse cursor in the global coordinate system (<a href="qmouseevent.html#globalPos">TQMouseEvent::globalPos</a>()). (If the click's press and release differ by a pixel or two, <em>pos</em> is the position at release time.) <p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonClicked">rightButtonClicked</a>(), and <a href="#clicked">clicked</a>(). <h3 class=fn>void <a name="mouseButtonPressed"></a>TQIconView::mouseButtonPressed ( int button, <a href="qiconviewitem.html">TQIconViewItem</a> * item, const <a href="ntqpoint.html">TQPoint</a> & pos )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user presses mouse button <em>button</em>. If <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null, the mouse cursor isn't on any item. <p> <em>pos</em> is the position of the mouse cursor in the global coordinate system (<a href="qmouseevent.html#globalPos">TQMouseEvent::globalPos</a>()). <p> <p>See also <a href="#rightButtonClicked">rightButtonClicked</a>() and <a href="#pressed">pressed</a>(). <h3 class=fn>void <a name="moved"></a>TQIconView::moved ()<tt> [signal]</tt> </h3> <p> This signal is emitted after successfully dropping one (or more) items of the icon view. If the items should be removed, it's best to do so in a slot connected to this signal. <p>Example: <a href="iconview-example.html#x1456">iconview/main.cpp</a>. <h3 class=fn>void <a name="onItem"></a>TQIconView::onItem ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user moves the mouse cursor onto an <em>item</em>, similar to the <a href="ntqwidget.html#enterEvent">TQWidget::enterEvent</a>() function. <h3 class=fn>void <a name="onViewport"></a>TQIconView::onViewport ()<tt> [signal]</tt> </h3> <p> This signal is emitted when the user moves the mouse cursor from an item to an empty part of the icon view. <p> <p>See also <a href="#onItem">onItem</a>(). <h3 class=fn>void <a name="pressed"></a>TQIconView::pressed ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user presses any mouse button. If <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null, the mouse cursor isn't on any item. <p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonPressed">rightButtonPressed</a>(), and <a href="#clicked">clicked</a>(). <h3 class=fn>void <a name="pressed-2"></a>TQIconView::pressed ( <a href="qiconviewitem.html">TQIconViewItem</a> * item, const <a href="ntqpoint.html">TQPoint</a> & pos )<tt> [signal]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> This signal is emitted when the user presses any mouse button. If <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null, the mouse cursor isn't on any item. <p> <em>pos</em> is the position of the mouse cursor in the global coordinate system (<a href="qmouseevent.html#globalPos">TQMouseEvent::globalPos</a>()). (If the click's press and release differ by a pixel or two, <em>pos</em> is the position at release time.) <p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonPressed">rightButtonPressed</a>(), and <a href="#clicked">clicked</a>(). <h3 class=fn>void <a name="repaintItem"></a>TQIconView::repaintItem ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [virtual]</tt> </h3> Repaints the <em>item</em>. <h3 class=fn>void <a name="repaintSelectedItems"></a>TQIconView::repaintSelectedItems () </h3> Repaints the selected items. <h3 class=fn><a href="ntqiconview.html#ResizeMode-enum">ResizeMode</a> <a name="resizeMode"></a>TQIconView::resizeMode () const </h3><p>Returns the resize mode of the icon view. See the <a href="ntqiconview.html#resizeMode-prop">"resizeMode"</a> property for details. <h3 class=fn>void <a name="returnPressed"></a>TQIconView::returnPressed ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [signal]</tt> </h3> <p> This signal is emitted if the user presses the Return or Enter key. <em>item</em> is the <a href="#currentItem">currentItem</a>() at the time of the keypress. <h3 class=fn>void <a name="rightButtonClicked"></a>TQIconView::rightButtonClicked ( <a href="qiconviewitem.html">TQIconViewItem</a> * item, const <a href="ntqpoint.html">TQPoint</a> & pos )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user clicks the right mouse button. If <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null, the mouse cursor isn't on any item. <p> <em>pos</em> is the position of the mouse cursor in the global coordinate system (<a href="qmouseevent.html#globalPos">TQMouseEvent::globalPos</a>()). (If the click's press and release differ by a pixel or two, <em>pos</em> is the position at release time.) <p> <p>See also <a href="#rightButtonPressed">rightButtonPressed</a>(), <a href="#mouseButtonClicked">mouseButtonClicked</a>(), and <a href="#clicked">clicked</a>(). <h3 class=fn>void <a name="rightButtonPressed"></a>TQIconView::rightButtonPressed ( <a href="qiconviewitem.html">TQIconViewItem</a> * item, const <a href="ntqpoint.html">TQPoint</a> & pos )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user presses the right mouse button. If <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null, the mouse cursor isn't on any item. <p> <em>pos</em> is the position of the mouse cursor in the global coordinate system (<a href="qmouseevent.html#globalPos">TQMouseEvent::globalPos</a>()). <h3 class=fn>void <a name="selectAll"></a>TQIconView::selectAll ( bool select )<tt> [virtual]</tt> </h3> In Multi and Extended modes, this function sets all items to be selected if <em>select</em> is TRUE, and to be unselected if <em>select</em> is FALSE. <p> In Single and NoSelection modes, this function only changes the selection status of <a href="#currentItem">currentItem</a>(). <h3 class=fn>void <a name="selectionChanged"></a>TQIconView::selectionChanged ()<tt> [signal]</tt> </h3> <p> This signal is emitted when the selection has been changed. It's emitted in each selection mode. <h3 class=fn>void <a name="selectionChanged-2"></a>TQIconView::selectionChanged ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [signal]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> This signal is emitted when the selection changes. <em>item</em> is the newly selected item. This signal is emitted only in single selection mode. <h3 class=fn><a href="ntqiconview.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode"></a>TQIconView::selectionMode () const </h3><p>Returns the selection mode of the icon view. See the <a href="ntqiconview.html#selectionMode-prop">"selectionMode"</a> property for details. <h3 class=fn>void <a name="setArrangement"></a>TQIconView::setArrangement ( <a href="ntqiconview.html#Arrangement-enum">Arrangement</a> am )<tt> [virtual]</tt> </h3><p>Sets the arrangement mode of the icon view to <em>am</em>. See the <a href="ntqiconview.html#arrangement-prop">"arrangement"</a> property for details. <h3 class=fn>void <a name="setAutoArrange"></a>TQIconView::setAutoArrange ( bool b )<tt> [virtual]</tt> </h3><p>Sets whether the icon view rearranges its items when a new item is inserted to <em>b</em>. See the <a href="ntqiconview.html#autoArrange-prop">"autoArrange"</a> property for details. <h3 class=fn>void <a name="setCurrentItem"></a>TQIconView::setCurrentItem ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [virtual]</tt> </h3> Makes <em>item</em> the new current item of the icon view. <h3 class=fn>void <a name="setGridX"></a>TQIconView::setGridX ( int rx )<tt> [virtual]</tt> </h3><p>Sets the horizontal grid of the icon view to <em>rx</em>. See the <a href="ntqiconview.html#gridX-prop">"gridX"</a> property for details. <h3 class=fn>void <a name="setGridY"></a>TQIconView::setGridY ( int ry )<tt> [virtual]</tt> </h3><p>Sets the vertical grid of the icon view to <em>ry</em>. See the <a href="ntqiconview.html#gridY-prop">"gridY"</a> property for details. <h3 class=fn>void <a name="setItemTextBackground"></a>TQIconView::setItemTextBackground ( const <a href="ntqbrush.html">TQBrush</a> & b )<tt> [virtual]</tt> </h3><p>Sets the brush to use when drawing the background of an item's text to <em>b</em>. See the <a href="ntqiconview.html#itemTextBackground-prop">"itemTextBackground"</a> property for details. <h3 class=fn>void <a name="setItemTextPos"></a>TQIconView::setItemTextPos ( <a href="ntqiconview.html#ItemTextPos-enum">ItemTextPos</a> pos )<tt> [virtual]</tt> </h3><p>Sets the position where the text of each item is drawn to <em>pos</em>. See the <a href="ntqiconview.html#itemTextPos-prop">"itemTextPos"</a> property for details. <h3 class=fn>void <a name="setItemsMovable"></a>TQIconView::setItemsMovable ( bool b )<tt> [virtual]</tt> </h3><p>Sets whether the user is allowed to move items around in the icon view to <em>b</em>. See the <a href="ntqiconview.html#itemsMovable-prop">"itemsMovable"</a> property for details. <h3 class=fn>void <a name="setMaxItemTextLength"></a>TQIconView::setMaxItemTextLength ( int w )<tt> [virtual]</tt> </h3><p>Sets the maximum length (in characters) that an item's text may have to <em>w</em>. See the <a href="ntqiconview.html#maxItemTextLength-prop">"maxItemTextLength"</a> property for details. <h3 class=fn>void <a name="setMaxItemWidth"></a>TQIconView::setMaxItemWidth ( int w )<tt> [virtual]</tt> </h3><p>Sets the maximum width that an item may have to <em>w</em>. See the <a href="ntqiconview.html#maxItemWidth-prop">"maxItemWidth"</a> property for details. <h3 class=fn>void <a name="setResizeMode"></a>TQIconView::setResizeMode ( <a href="ntqiconview.html#ResizeMode-enum">ResizeMode</a> am )<tt> [virtual]</tt> </h3><p>Sets the resize mode of the icon view to <em>am</em>. See the <a href="ntqiconview.html#resizeMode-prop">"resizeMode"</a> property for details. <h3 class=fn>void <a name="setSelected"></a>TQIconView::setSelected ( <a href="qiconviewitem.html">TQIconViewItem</a> * item, bool s, bool cb = FALSE )<tt> [virtual]</tt> </h3> Selects or unselects <em>item</em> depending on <em>s</em>, and may also unselect other items, depending on <a href="#selectionMode">TQIconView::selectionMode</a>() and <em>cb</em>. <p> If <em>s</em> is FALSE, <em>item</em> is unselected. <p> If <em>s</em> is TRUE and TQIconView::selectionMode() is <a href="#SelectionMode-enum">Single</a>, <em>item</em> is selected, and the item which was selected is unselected. <p> If <em>s</em> is TRUE and TQIconView::selectionMode() is <a href="#SelectionMode-enum">Extended</a>, <em>item</em> is selected. If <em>cb</em> is TRUE, the selection state of the icon view's 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 <a href="#SelectionMode-enum">Multi</a> <em>item</em> is selected. <p> Note that <em>cb</em> is used only if TQIconView::selectionMode() is <a href="#SelectionMode-enum">Extended</a>. <em>cb</em> defaults to FALSE. <p> All items whose selection status is changed repaint themselves. <h3 class=fn>void <a name="setSelectionMode"></a>TQIconView::setSelectionMode ( <a href="ntqiconview.html#SelectionMode-enum">SelectionMode</a> m )<tt> [virtual]</tt> </h3><p>Sets the selection mode of the icon view to <em>m</em>. See the <a href="ntqiconview.html#selectionMode-prop">"selectionMode"</a> property for details. <h3 class=fn>void <a name="setShowToolTips"></a>TQIconView::setShowToolTips ( bool b )<tt> [virtual]</tt> </h3><p>Sets whether the icon view will display a tool tip with the complete text for any truncated item text to <em>b</em>. See the <a href="ntqiconview.html#showToolTips-prop">"showToolTips"</a> property for details. <h3 class=fn>void <a name="setSorting"></a>TQIconView::setSorting ( bool sort, bool ascending = TRUE ) </h3> If <em>sort</em> is TRUE, this function sets the icon view to sort items when a new item is inserted. If <em>sort</em> is FALSE, the icon view will not be sorted. <p> Note that <a href="#autoArrange">autoArrange</a>() must be TRUE for sorting to take place. <p> If <em>ascending</em> is TRUE (the default), items are sorted in ascending order. If <em>ascending</em> is FALSE, items are sorted in descending order. <p> <a href="qiconviewitem.html#compare">TQIconViewItem::compare</a>() is used to compare pairs of items. The sorting is based on the items' keys; these default to the items' text unless specifically set to something else. <p> <p>See also <a href="#autoArrange-prop">TQIconView::autoArrange</a>, <a href="#autoArrange-prop">TQIconView::autoArrange</a>, <a href="#sortDirection-prop">sortDirection</a>, <a href="#sort">sort</a>(), and <a href="qiconviewitem.html#setKey">TQIconViewItem::setKey</a>(). <h3 class=fn>void <a name="setSpacing"></a>TQIconView::setSpacing ( int sp )<tt> [virtual]</tt> </h3><p>Sets the space in pixels between icon view items to <em>sp</em>. See the <a href="ntqiconview.html#spacing-prop">"spacing"</a> property for details. <h3 class=fn>void <a name="setWordWrapIconText"></a>TQIconView::setWordWrapIconText ( bool b )<tt> [virtual]</tt> </h3><p>Sets whether the item text will be word-wrapped if it is too long to <em>b</em>. See the <a href="ntqiconview.html#wordWrapIconText-prop">"wordWrapIconText"</a> property for details. <h3 class=fn>bool <a name="showToolTips"></a>TQIconView::showToolTips () const </h3><p>Returns TRUE if the icon view will display a tool tip with the complete text for any truncated item text; otherwise returns FALSE. See the <a href="ntqiconview.html#showToolTips-prop">"showToolTips"</a> property for details. <h3 class=fn>void <a name="slotUpdate"></a>TQIconView::slotUpdate ()<tt> [virtual protected slot]</tt> </h3> This slot is used for a slightly-delayed update. <p> The icon view is not redrawn immediately after inserting a new item but after a very small delay using a <a href="ntqtimer.html">TQTimer</a>. This means that when many items are inserted in a loop the icon view is probably redrawn only once at the end of the loop. This makes the insertions both flicker-free and faster. <h3 class=fn>void <a name="sort"></a>TQIconView::sort ( bool ascending = TRUE )<tt> [virtual]</tt> </h3> Sorts and rearranges all the items in the icon view. If <em>ascending</em> is TRUE, the items are sorted in increasing order, otherwise they are sorted in decreasing order. <p> <a href="qiconviewitem.html#compare">TQIconViewItem::compare</a>() is used to compare pairs of items. The sorting is based on the items' keys; these default to the items' text unless specifically set to something else. <p> Note that this function sets the sort order to <em>ascending</em>. <p> <p>See also <a href="qiconviewitem.html#key">TQIconViewItem::key</a>(), <a href="qiconviewitem.html#setKey">TQIconViewItem::setKey</a>(), <a href="qiconviewitem.html#compare">TQIconViewItem::compare</a>(), <a href="#setSorting">TQIconView::setSorting</a>(), and <a href="#sortDirection-prop">TQIconView::sortDirection</a>. <h3 class=fn>bool <a name="sortDirection"></a>TQIconView::sortDirection () const </h3><p>Returns TRUE if the sort direction for inserting new items is ascending;; otherwise returns FALSE. See the <a href="ntqiconview.html#sortDirection-prop">"sortDirection"</a> property for details. <h3 class=fn>bool <a name="sorting"></a>TQIconView::sorting () const </h3><p>Returns TRUE if the icon view sorts on insertion; otherwise returns FALSE. See the <a href="ntqiconview.html#sorting-prop">"sorting"</a> property for details. <h3 class=fn>int <a name="spacing"></a>TQIconView::spacing () const </h3><p>Returns the space in pixels between icon view items. See the <a href="ntqiconview.html#spacing-prop">"spacing"</a> property for details. <h3 class=fn>void <a name="startDrag"></a>TQIconView::startDrag ()<tt> [virtual protected]</tt> </h3> Starts a drag. <h3 class=fn>void <a name="takeItem"></a>TQIconView::takeItem ( <a href="qiconviewitem.html">TQIconViewItem</a> * item )<tt> [virtual]</tt> </h3> Takes the icon view item <em>item</em> out of the icon view and causes an update of the screen display. The item is not deleted. You should normally not need to call this function because <a href="qiconviewitem.html#~TQIconViewItem">TQIconViewItem::~TQIconViewItem</a>() calls it. The normal way to delete an item is to delete it. <h3 class=fn>bool <a name="wordWrapIconText"></a>TQIconView::wordWrapIconText () const </h3><p>Returns TRUE if the item text will be word-wrapped if it is too long; otherwise returns FALSE. See the <a href="ntqiconview.html#wordWrapIconText-prop">"wordWrapIconText"</a> property for details. <hr><h2>Property Documentation</h2> <h3 class=fn><a href="ntqiconview.html#Arrangement-enum">Arrangement</a> <a name="arrangement-prop"></a>arrangement</h3> <p>This property holds the arrangement mode of the icon view. <p>This can be <a href="#Arrangement-enum">LeftToRight</a> or <a href="#Arrangement-enum">TopToBottom</a>. The default is <a href="#Arrangement-enum">LeftToRight</a>. <p>Set this property's value with <a href="#setArrangement">setArrangement</a>() and get this property's value with <a href="#arrangement">arrangement</a>(). <h3 class=fn>bool <a name="autoArrange-prop"></a>autoArrange</h3> <p>This property holds whether the icon view rearranges its items when a new item is inserted. <p>The default is TRUE. <p> Note that if the icon view is not visible at the time of insertion, TQIconView defers all position-related work until it is shown and then calls <a href="#arrangeItemsInGrid">arrangeItemsInGrid</a>(). <p>Set this property's value with <a href="#setAutoArrange">setAutoArrange</a>() and get this property's value with <a href="#autoArrange">autoArrange</a>(). <h3 class=fn>uint <a name="count-prop"></a>count</h3> <p>This property holds the number of items in the icon view. <p> <p>Get this property's value with <a href="#count">count</a>(). <h3 class=fn>int <a name="gridX-prop"></a>gridX</h3> <p>This property holds the horizontal grid of the icon view. <p>If the value is -1, (the default), TQIconView computes suitable column widths based on the icon view's contents. <p> Note that setting a grid width overrides <a href="#setMaxItemWidth">setMaxItemWidth</a>(). <p>Set this property's value with <a href="#setGridX">setGridX</a>() and get this property's value with <a href="#gridX">gridX</a>(). <h3 class=fn>int <a name="gridY-prop"></a>gridY</h3> <p>This property holds the vertical grid of the icon view. <p>If the value is -1, (the default), TQIconView computes suitable column heights based on the icon view's contents. <p>Set this property's value with <a href="#setGridY">setGridY</a>() and get this property's value with <a href="#gridY">gridY</a>(). <h3 class=fn><a href="ntqbrush.html">TQBrush</a> <a name="itemTextBackground-prop"></a>itemTextBackground</h3> <p>This property holds the brush to use when drawing the background of an item's text. <p>By default this brush is set to NoBrush, meaning that only the normal icon view background is used. <p>Set this property's value with <a href="#setItemTextBackground">setItemTextBackground</a>() and get this property's value with <a href="#itemTextBackground">itemTextBackground</a>(). <h3 class=fn><a href="ntqiconview.html#ItemTextPos-enum">ItemTextPos</a> <a name="itemTextPos-prop"></a>itemTextPos</h3> <p>This property holds the position where the text of each item is drawn. <p>Valid values are <a href="#ItemTextPos-enum">Bottom</a> or <a href="#ItemTextPos-enum">Right</a>. The default is <a href="#ItemTextPos-enum">Bottom</a>. <p>Set this property's value with <a href="#setItemTextPos">setItemTextPos</a>() and get this property's value with <a href="#itemTextPos">itemTextPos</a>(). <h3 class=fn>bool <a name="itemsMovable-prop"></a>itemsMovable</h3> <p>This property holds whether the user is allowed to move items around in the icon view. <p>The default is TRUE. <p>Set this property's value with <a href="#setItemsMovable">setItemsMovable</a>() and get this property's value with <a href="#itemsMovable">itemsMovable</a>(). <h3 class=fn>int <a name="maxItemTextLength-prop"></a>maxItemTextLength</h3> <p>This property holds the maximum length (in characters) that an item's text may have. <p>The default is 255 characters. <p>Set this property's value with <a href="#setMaxItemTextLength">setMaxItemTextLength</a>() and get this property's value with <a href="#maxItemTextLength">maxItemTextLength</a>(). <h3 class=fn>int <a name="maxItemWidth-prop"></a>maxItemWidth</h3> <p>This property holds the maximum width that an item may have. <p>The default is 100 pixels. <p> Note that if the <a href="#gridX">gridX</a>() value is set TQIconView will ignore this property. <p>Set this property's value with <a href="#setMaxItemWidth">setMaxItemWidth</a>() and get this property's value with <a href="#maxItemWidth">maxItemWidth</a>(). <h3 class=fn><a href="ntqiconview.html#ResizeMode-enum">ResizeMode</a> <a name="resizeMode-prop"></a>resizeMode</h3> <p>This property holds the resize mode of the icon view. <p>This can be <a href="#ResizeMode-enum">Fixed</a> or <a href="#ResizeMode-enum">Adjust</a>. The default is <a href="#ResizeMode-enum">Fixed</a>. See <a href="#ResizeMode-enum">ResizeMode</a>. <p>Set this property's value with <a href="#setResizeMode">setResizeMode</a>() and get this property's value with <a href="#resizeMode">resizeMode</a>(). <h3 class=fn><a href="ntqiconview.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode-prop"></a>selectionMode</h3> <p>This property holds the selection mode of the icon view. <p>This can be <a href="#SelectionMode-enum">Single</a> (the default), <a href="#SelectionMode-enum">Extended</a>, <a href="#SelectionMode-enum">Multi</a> or <a href="#SelectionMode-enum">NoSelection</a>. <p>Set this property's value with <a href="#setSelectionMode">setSelectionMode</a>() and get this property's value with <a href="#selectionMode">selectionMode</a>(). <h3 class=fn>bool <a name="showToolTips-prop"></a>showToolTips</h3> <p>This property holds whether the icon view will display a tool tip with the complete text for any truncated item text. <p>The default is TRUE. Note that this has no effect if <a href="#setWordWrapIconText">setWordWrapIconText</a>() is TRUE, as it is by default. <p>Set this property's value with <a href="#setShowToolTips">setShowToolTips</a>() and get this property's value with <a href="#showToolTips">showToolTips</a>(). <h3 class=fn>bool <a name="sortDirection-prop"></a>sortDirection</h3> <p>This property holds whether the sort direction for inserting new items is ascending;. <p>The default is TRUE (i.e. ascending). This sort direction is only meaningful if both <a href="#sorting">sorting</a>() and <a href="#autoArrange">autoArrange</a>() are TRUE. <p> To set the sort direction, use <a href="#setSorting">setSorting</a>() <p>Get this property's value with <a href="#sortDirection">sortDirection</a>(). <h3 class=fn>bool <a name="sorting-prop"></a>sorting</h3> <p>This property holds whether the icon view sorts on insertion. <p>The default is FALSE, i.e. no sorting on insertion. <p> To set the sorting, use <a href="#setSorting">setSorting</a>(). <p>Get this property's value with <a href="#sorting">sorting</a>(). <h3 class=fn>int <a name="spacing-prop"></a>spacing</h3> <p>This property holds the space in pixels between icon view items. <p>The default is 5 pixels. <p> Negative values for spacing are illegal. <p>Set this property's value with <a href="#setSpacing">setSpacing</a>() and get this property's value with <a href="#spacing">spacing</a>(). <h3 class=fn>bool <a name="wordWrapIconText-prop"></a>wordWrapIconText</h3> <p>This property holds whether the item text will be word-wrapped if it is too long. <p>The default is TRUE. <p> If this property is FALSE, icon text that is too long is truncated, and an ellipsis (...) appended to indicate that truncation has occurred. The full text can still be seen by the user if they hover the mouse because the full text is shown in a tooltip; see <a href="#setShowToolTips">setShowToolTips</a>(). <p>Set this property's value with <a href="#setWordWrapIconText">setWordWrapIconText</a>() and get this property's value with <a href="#wordWrapIconText">wordWrapIconText</a>(). <!-- eof --> <hr><p> This file is part of the <a href="index.html">TQt toolkit</a>. Copyright © 1995-2007 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2007 <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a> <td align=right><div align=right>TQt 3.3.8</div> </table></div></address></body> </html>