<tdalign="right"valign="center"><imgsrc="logo32.png"align="right"width="64"height="32"border="0"></td></tr></table><h1align=center>TQIconView Class Reference<br><small>[<ahref="iconview.html">iconview module</a>]</small></h1>
<p>The TQIconView class provides an area with movable labelled icons.
<liclass=fn>Arrangement <ahref="#arrangement-prop"><b>arrangement</b></a> - the arrangement mode of the icon view</li>
<liclass=fn>bool <ahref="#autoArrange-prop"><b>autoArrange</b></a> - whether the icon view rearranges its items when a new item is inserted</li>
<liclass=fn>uint <ahref="#count-prop"><b>count</b></a> - the number of items in the icon view <em>(read only)</em></li>
<liclass=fn>int <ahref="#gridX-prop"><b>gridX</b></a> - the horizontal grid of the icon view</li>
<liclass=fn>int <ahref="#gridY-prop"><b>gridY</b></a> - the vertical grid of the icon view</li>
<liclass=fn>TQBrush <ahref="#itemTextBackground-prop"><b>itemTextBackground</b></a> - the brush to use when drawing the background of an item's text</li>
<liclass=fn>ItemTextPos <ahref="#itemTextPos-prop"><b>itemTextPos</b></a> - the position where the text of each item is drawn</li>
<liclass=fn>bool <ahref="#itemsMovable-prop"><b>itemsMovable</b></a> - whether the user is allowed to move items around in the icon view</li>
<liclass=fn>int <ahref="#maxItemTextLength-prop"><b>maxItemTextLength</b></a> - the maximum length (in characters) that an item's text may have</li>
<liclass=fn>int <ahref="#maxItemWidth-prop"><b>maxItemWidth</b></a> - the maximum width that an item may have</li>
<liclass=fn>ResizeMode <ahref="#resizeMode-prop"><b>resizeMode</b></a> - the resize mode of the icon view</li>
<liclass=fn>SelectionMode <ahref="#selectionMode-prop"><b>selectionMode</b></a> - the selection mode of the icon view</li>
<liclass=fn>bool <ahref="#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>
<liclass=fn>bool <ahref="#sortDirection-prop"><b>sortDirection</b></a> - whether the sort direction for inserting new items is ascending; <em>(read only)</em></li>
<liclass=fn>bool <ahref="#sorting-prop"><b>sorting</b></a> - whether the icon view sorts on insertion <em>(read only)</em></li>
<liclass=fn>int <ahref="#spacing-prop"><b>spacing</b></a> - the space in pixels between icon view items</li>
<liclass=fn>bool <ahref="#wordWrapIconText-prop"><b>wordWrapIconText</b></a> - whether the item text will be word-wrapped if it is too long</li>
TQIconView also provides <ahref="#currentItem">currentItem</a>(). You can search for an item
using <ahref="#findItem">findItem</a>() (searching by position or for label text) and
with <ahref="#findFirstVisibleItem">findFirstVisibleItem</a>() and <ahref="#findLastVisibleItem">findLastVisibleItem</a>(). The number
of items is returned by <ahref="#count">count</a>(). An item can be removed from an
icon view using <ahref="#takeItem">takeItem</a>(); to delete an item use <tt>delete</tt>. All
the items can be deleted with <ahref="#clear">clear</a>().
<p> The TQIconView emits a wide range of useful signals, including
<ahref="#selectionChanged">selectionChanged</a>(), <ahref="#currentChanged">currentChanged</a>(), <ahref="#clicked">clicked</a>(), <ahref="#moved">moved</a>() and
<ahref="#itemRenamed">itemRenamed</a>().
<p><aname="draganddrop"></a>
<h3> Drag and Drop
</h3>
<aname="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 <ahref="#dragObject">TQIconView::dragObject</a>().
<p> See <ahref="iconview-simple_dd-main-h.html">iconview/simple_dd/main.h</a> and <ahref="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
<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 <ahref="qicondrag.html">TQIconDrag</a> (or a
class derived from it) for the drag object. In <ahref="#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 <ahref="qicondragitem.html">TQIconDragItem</a> for
each selected item, and append these items with <ahref="qicondrag.html#append">TQIconDrag::append</a>() to
the TQIconDrag object. You can use <ahref="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 <ahref="#dropped">dropped</a>() signal and reimplement
<ahref="qiconviewitem.html#acceptDrop">TQIconViewItem::acceptDrop</a>() and <ahref="qiconviewitem.html#dropped">TQIconViewItem::dropped</a>(). If you've
used a <ahref="qicondrag.html">TQIconDrag</a> (or a subclass of it) the second argument to the
access their data by calling <ahref="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 <ahref="qiconviewitem.html#setDragEnabled">TQIconViewItem::setDragEnabled</a>(), <ahref="qiconviewitem.html#setDropEnabled">TQIconViewItem::setDropEnabled</a>(), <ahref="qiconviewitem.html#acceptDrop">TQIconViewItem::acceptDrop</a>(), <ahref="qiconviewitem.html#dropped">TQIconViewItem::dropped</a>(), and <ahref="advanced.html">Advanced Widgets</a>.
<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 <ahref="#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: <ahref="#SelectionMode-enum">Single</a> is a real single-selection icon view; <ahref="#SelectionMode-enum">Multi</a> a real multi-selection icon view; <ahref="#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 <ahref="#SelectionMode-enum">NoSelection</a> mode is for an icon view where the user can look but
This variant uses <em>grid</em> instead of (<ahref="#gridX">gridX</a>(), <ahref="#gridY">gridY</a>()). If <em>grid</em> is invalid (see <ahref="ntqsize.html#isValid">TQSize::isValid</a>()), <ahref="#arrangeItemsInGrid">arrangeItemsInGrid</a>()
<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 <ahref="#mouseButtonClicked">mouseButtonClicked</a>(), <ahref="#rightButtonClicked">rightButtonClicked</a>(), and <ahref="#pressed">pressed</a>().
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 (<ahref="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 <ahref="#mouseButtonClicked">mouseButtonClicked</a>(), <ahref="#rightButtonClicked">rightButtonClicked</a>(), and <ahref="#pressed">pressed</a>().
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 <ahref="qicondrag.html">TQIconDrag</a>.
<p>Examples: <ahref="fileiconview-example.html#x834">fileiconview/qfileiconview.cpp</a> and <ahref="simple_dd-example.html#x2820">iconview/simple_dd/main.cpp</a>.
<p><p>See also <ahref="ntqscrollview.html#contentsX-prop">contentsX</a>, <ahref="ntqscrollview.html#contentsY-prop">contentsY</a>, and <ahref="ntqscrollview.html#drawContents">drawContents</a>().
Inserts the <ahref="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
<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 <ahref="qiconviewitem.html#setRenameEnabled">TQIconViewItem::setRenameEnabled</a>() and <ahref="qiconviewitem.html#rename">TQIconViewItem::rename</a>().
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 <ahref="qiconviewitem.html#setRenameEnabled">TQIconViewItem::setRenameEnabled</a>() and <ahref="qiconviewitem.html#rename">TQIconViewItem::rename</a>().
<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 (<ahref="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 <ahref="#mouseButtonPressed">mouseButtonPressed</a>(), <ahref="#rightButtonClicked">rightButtonClicked</a>(), and <ahref="#clicked">clicked</a>().
<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 (<ahref="qmouseevent.html#globalPos">TQMouseEvent::globalPos</a>()).
<p><p>See also <ahref="#rightButtonClicked">rightButtonClicked</a>() and <ahref="#pressed">pressed</a>().
<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 <ahref="#mouseButtonPressed">mouseButtonPressed</a>(), <ahref="#rightButtonPressed">rightButtonPressed</a>(), and <ahref="#clicked">clicked</a>().
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 (<ahref="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 <ahref="#mouseButtonPressed">mouseButtonPressed</a>(), <ahref="#rightButtonPressed">rightButtonPressed</a>(), and <ahref="#clicked">clicked</a>().
<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 (<ahref="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 <ahref="#rightButtonPressed">rightButtonPressed</a>(), <ahref="#mouseButtonClicked">mouseButtonClicked</a>(), and <ahref="#clicked">clicked</a>().
Selects or unselects <em>item</em> depending on <em>s</em>, and may also
unselect other items, depending on <ahref="#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 <ahref="#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 <ahref="#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 <ahref="#SelectionMode-enum">Multi</a><em>item</em>
is selected.
<p> Note that <em>cb</em> is used only if TQIconView::selectionMode() is <ahref="#SelectionMode-enum">Extended</a>. <em>cb</em> defaults to FALSE.
<p> All items whose selection status is changed repaint themselves.
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 <ahref="#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><ahref="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 <ahref="#autoArrange-prop">TQIconView::autoArrange</a>, <ahref="#autoArrange-prop">TQIconView::autoArrange</a>, <ahref="#sortDirection-prop">sortDirection</a>, <ahref="#sort">sort</a>(), and <ahref="qiconviewitem.html#setKey">TQIconViewItem::setKey</a>().
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><ahref="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 <ahref="qiconviewitem.html#key">TQIconViewItem::key</a>(), <ahref="qiconviewitem.html#setKey">TQIconViewItem::setKey</a>(), <ahref="qiconviewitem.html#compare">TQIconViewItem::compare</a>(), <ahref="#setSorting">TQIconView::setSorting</a>(), and <ahref="#sortDirection-prop">TQIconView::sortDirection</a>.
<p>This property holds the arrangement mode of the icon view.
<p>This can be <ahref="#Arrangement-enum">LeftToRight</a> or <ahref="#Arrangement-enum">TopToBottom</a>. The default is <ahref="#Arrangement-enum">LeftToRight</a>.
<p>Set this property's value with <ahref="#setArrangement">setArrangement</a>() and get this property's value with <ahref="#arrangement">arrangement</a>().
<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 <ahref="#arrangeItemsInGrid">arrangeItemsInGrid</a>().
<p>Set this property's value with <ahref="#setAutoArrange">setAutoArrange</a>() and get this property's value with <ahref="#autoArrange">autoArrange</a>().
<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 <ahref="#setItemTextBackground">setItemTextBackground</a>() and get this property's value with <ahref="#itemTextBackground">itemTextBackground</a>().
<p>This property holds the position where the text of each item is drawn.
<p>Valid values are <ahref="#ItemTextPos-enum">Bottom</a> or <ahref="#ItemTextPos-enum">Right</a>. The default is <ahref="#ItemTextPos-enum">Bottom</a>.
<p>Set this property's value with <ahref="#setItemTextPos">setItemTextPos</a>() and get this property's value with <ahref="#itemTextPos">itemTextPos</a>().
<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 <ahref="#setItemsMovable">setItemsMovable</a>() and get this property's value with <ahref="#itemsMovable">itemsMovable</a>().
<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 <ahref="#setMaxItemTextLength">setMaxItemTextLength</a>() and get this property's value with <ahref="#maxItemTextLength">maxItemTextLength</a>().
<p>This property holds the maximum width that an item may have.
<p>The default is 100 pixels.
<p> Note that if the <ahref="#gridX">gridX</a>() value is set TQIconView will ignore
this property.
<p>Set this property's value with <ahref="#setMaxItemWidth">setMaxItemWidth</a>() and get this property's value with <ahref="#maxItemWidth">maxItemWidth</a>().
<p>This property holds the resize mode of the icon view.
<p>This can be <ahref="#ResizeMode-enum">Fixed</a> or <ahref="#ResizeMode-enum">Adjust</a>. The default is <ahref="#ResizeMode-enum">Fixed</a>.
See <ahref="#ResizeMode-enum">ResizeMode</a>.
<p>Set this property's value with <ahref="#setResizeMode">setResizeMode</a>() and get this property's value with <ahref="#resizeMode">resizeMode</a>().
<p>This property holds the selection mode of the icon view.
<p>This can be <ahref="#SelectionMode-enum">Single</a> (the default), <ahref="#SelectionMode-enum">Extended</a>, <ahref="#SelectionMode-enum">Multi</a> or <ahref="#SelectionMode-enum">NoSelection</a>.
<p>Set this property's value with <ahref="#setSelectionMode">setSelectionMode</a>() and get this property's value with <ahref="#selectionMode">selectionMode</a>().
<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
<ahref="#setWordWrapIconText">setWordWrapIconText</a>() is TRUE, as it is by default.
<p>Set this property's value with <ahref="#setShowToolTips">setShowToolTips</a>() and get this property's value with <ahref="#showToolTips">showToolTips</a>().
<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 <ahref="#setShowToolTips">setShowToolTips</a>().
<p>Set this property's value with <ahref="#setWordWrapIconText">setWordWrapIconText</a>() and get this property's value with <ahref="#wordWrapIconText">wordWrapIconText</a>().
<!-- eof -->
<hr><p>
This file is part of the <ahref="index.html">TQt toolkit</a>.