1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/iconview/qiconview.cpp:2261 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>QIconView Class</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QIconView Class Reference<br><small>[<a href="iconview.html">iconview module</a>]</small></h1>
|
---|
33 |
|
---|
34 | <p>The QIconView class provides an area with movable labelled icons.
|
---|
35 | <a href="#details">More...</a>
|
---|
36 | <p><tt>#include <<a href="qiconview-h.html">qiconview.h</a>></tt>
|
---|
37 | <p>Inherits <a href="qscrollview.html">QScrollView</a>.
|
---|
38 | <p><a href="qiconview-members.html">List of all member functions.</a>
|
---|
39 | <h2>Public Members</h2>
|
---|
40 | <ul>
|
---|
41 | <li class=fn>enum <a href="#SelectionMode-enum"><b>SelectionMode</b></a> { Single = 0, Multi, Extended, NoSelection }</li>
|
---|
42 | <li class=fn>enum <a href="#Arrangement-enum"><b>Arrangement</b></a> { LeftToRight = 0, TopToBottom }</li>
|
---|
43 | <li class=fn>enum <a href="#ResizeMode-enum"><b>ResizeMode</b></a> { Fixed = 0, Adjust }</li>
|
---|
44 | <li class=fn>enum <a href="#ItemTextPos-enum"><b>ItemTextPos</b></a> { Bottom = 0, Right }</li>
|
---|
45 | <li class=fn><a href="#QIconView"><b>QIconView</b></a> ( QWidget * parent = 0, const char * name = 0, WFlags f = 0 )</li>
|
---|
46 | <li class=fn>virtual <a href="#~QIconView"><b>~QIconView</b></a> ()</li>
|
---|
47 | <li class=fn>virtual void <a href="#insertItem"><b>insertItem</b></a> ( QIconViewItem * item, QIconViewItem * after = 0L )</li>
|
---|
48 | <li class=fn>virtual void <a href="#takeItem"><b>takeItem</b></a> ( QIconViewItem * item )</li>
|
---|
49 | <li class=fn>int <a href="#index"><b>index</b></a> ( const QIconViewItem * item ) const</li>
|
---|
50 | <li class=fn>QIconViewItem * <a href="#firstItem"><b>firstItem</b></a> () const</li>
|
---|
51 | <li class=fn>QIconViewItem * <a href="#lastItem"><b>lastItem</b></a> () const</li>
|
---|
52 | <li class=fn>QIconViewItem * <a href="#currentItem"><b>currentItem</b></a> () const</li>
|
---|
53 | <li class=fn>virtual void <a href="#setCurrentItem"><b>setCurrentItem</b></a> ( QIconViewItem * item )</li>
|
---|
54 | <li class=fn>virtual void <a href="#setSelected"><b>setSelected</b></a> ( QIconViewItem * item, bool s, bool cb = FALSE )</li>
|
---|
55 | <li class=fn>uint <a href="#count"><b>count</b></a> () const</li>
|
---|
56 | <li class=fn>virtual void <a href="#setSelectionMode"><b>setSelectionMode</b></a> ( SelectionMode m )</li>
|
---|
57 | <li class=fn>SelectionMode <a href="#selectionMode"><b>selectionMode</b></a> () const</li>
|
---|
58 | <li class=fn>QIconViewItem * <a href="#findItem"><b>findItem</b></a> ( const QPoint & pos ) const</li>
|
---|
59 | <li class=fn>QIconViewItem * <a href="#findItem-2"><b>findItem</b></a> ( const QString & text, ComparisonFlags compare = BeginsWith ) const</li>
|
---|
60 | <li class=fn>virtual void <a href="#selectAll"><b>selectAll</b></a> ( bool select )</li>
|
---|
61 | <li class=fn>virtual void <a href="#clearSelection"><b>clearSelection</b></a> ()</li>
|
---|
62 | <li class=fn>virtual void <a href="#invertSelection"><b>invertSelection</b></a> ()</li>
|
---|
63 | <li class=fn>virtual void <a href="#repaintItem"><b>repaintItem</b></a> ( QIconViewItem * item )</li>
|
---|
64 | <li class=fn>void <a href="#repaintSelectedItems"><b>repaintSelectedItems</b></a> ()</li>
|
---|
65 | <li class=fn>void <a href="#ensureItemVisible"><b>ensureItemVisible</b></a> ( QIconViewItem * item )</li>
|
---|
66 | <li class=fn>QIconViewItem * <a href="#findFirstVisibleItem"><b>findFirstVisibleItem</b></a> ( const QRect & r ) const</li>
|
---|
67 | <li class=fn>QIconViewItem * <a href="#findLastVisibleItem"><b>findLastVisibleItem</b></a> ( const QRect & r ) const</li>
|
---|
68 | <li class=fn>virtual void <a href="#clear"><b>clear</b></a> ()</li>
|
---|
69 | <li class=fn>virtual void <a href="#setGridX"><b>setGridX</b></a> ( int rx )</li>
|
---|
70 | <li class=fn>virtual void <a href="#setGridY"><b>setGridY</b></a> ( int ry )</li>
|
---|
71 | <li class=fn>int <a href="#gridX"><b>gridX</b></a> () const</li>
|
---|
72 | <li class=fn>int <a href="#gridY"><b>gridY</b></a> () const</li>
|
---|
73 | <li class=fn>virtual void <a href="#setSpacing"><b>setSpacing</b></a> ( int sp )</li>
|
---|
74 | <li class=fn>int <a href="#spacing"><b>spacing</b></a> () const</li>
|
---|
75 | <li class=fn>virtual void <a href="#setItemTextPos"><b>setItemTextPos</b></a> ( ItemTextPos pos )</li>
|
---|
76 | <li class=fn>ItemTextPos <a href="#itemTextPos"><b>itemTextPos</b></a> () const</li>
|
---|
77 | <li class=fn>virtual void <a href="#setItemTextBackground"><b>setItemTextBackground</b></a> ( const QBrush & b )</li>
|
---|
78 | <li class=fn>QBrush <a href="#itemTextBackground"><b>itemTextBackground</b></a> () const</li>
|
---|
79 | <li class=fn>virtual void <a href="#setArrangement"><b>setArrangement</b></a> ( Arrangement am )</li>
|
---|
80 | <li class=fn>Arrangement <a href="#arrangement"><b>arrangement</b></a> () const</li>
|
---|
81 | <li class=fn>virtual void <a href="#setResizeMode"><b>setResizeMode</b></a> ( ResizeMode am )</li>
|
---|
82 | <li class=fn>ResizeMode <a href="#resizeMode"><b>resizeMode</b></a> () const</li>
|
---|
83 | <li class=fn>virtual void <a href="#setMaxItemWidth"><b>setMaxItemWidth</b></a> ( int w )</li>
|
---|
84 | <li class=fn>int <a href="#maxItemWidth"><b>maxItemWidth</b></a> () const</li>
|
---|
85 | <li class=fn>virtual void <a href="#setMaxItemTextLength"><b>setMaxItemTextLength</b></a> ( int w )</li>
|
---|
86 | <li class=fn>int <a href="#maxItemTextLength"><b>maxItemTextLength</b></a> () const</li>
|
---|
87 | <li class=fn>virtual void <a href="#setAutoArrange"><b>setAutoArrange</b></a> ( bool b )</li>
|
---|
88 | <li class=fn>bool <a href="#autoArrange"><b>autoArrange</b></a> () const</li>
|
---|
89 | <li class=fn>virtual void <a href="#setShowToolTips"><b>setShowToolTips</b></a> ( bool b )</li>
|
---|
90 | <li class=fn>bool <a href="#showToolTips"><b>showToolTips</b></a> () const</li>
|
---|
91 | <li class=fn>void <a href="#setSorting"><b>setSorting</b></a> ( bool sort, bool ascending = TRUE )</li>
|
---|
92 | <li class=fn>bool <a href="#sorting"><b>sorting</b></a> () const</li>
|
---|
93 | <li class=fn>bool <a href="#sortDirection"><b>sortDirection</b></a> () const</li>
|
---|
94 | <li class=fn>virtual void <a href="#setItemsMovable"><b>setItemsMovable</b></a> ( bool b )</li>
|
---|
95 | <li class=fn>bool <a href="#itemsMovable"><b>itemsMovable</b></a> () const</li>
|
---|
96 | <li class=fn>virtual void <a href="#setWordWrapIconText"><b>setWordWrapIconText</b></a> ( bool b )</li>
|
---|
97 | <li class=fn>bool <a href="#wordWrapIconText"><b>wordWrapIconText</b></a> () const</li>
|
---|
98 | <li class=fn>virtual void <a href="#sort"><b>sort</b></a> ( bool ascending = TRUE )</li>
|
---|
99 | <li class=fn>bool <a href="#isRenaming"><b>isRenaming</b></a> () const</li>
|
---|
100 | </ul>
|
---|
101 | <h2>Public Slots</h2>
|
---|
102 | <ul>
|
---|
103 | <li class=fn>virtual void <a href="#arrangeItemsInGrid"><b>arrangeItemsInGrid</b></a> ( const QSize & grid, bool update = TRUE )</li>
|
---|
104 | <li class=fn>virtual void <a href="#arrangeItemsInGrid-2"><b>arrangeItemsInGrid</b></a> ( bool update = TRUE )</li>
|
---|
105 | </ul>
|
---|
106 | <h2>Signals</h2>
|
---|
107 | <ul>
|
---|
108 | <li class=fn>void <a href="#selectionChanged"><b>selectionChanged</b></a> ()</li>
|
---|
109 | <li class=fn>void <a href="#selectionChanged-2"><b>selectionChanged</b></a> ( QIconViewItem * item )</li>
|
---|
110 | <li class=fn>void <a href="#currentChanged"><b>currentChanged</b></a> ( QIconViewItem * item )</li>
|
---|
111 | <li class=fn>void <a href="#clicked"><b>clicked</b></a> ( QIconViewItem * item )</li>
|
---|
112 | <li class=fn>void <a href="#clicked-2"><b>clicked</b></a> ( QIconViewItem * item, const QPoint & pos )</li>
|
---|
113 | <li class=fn>void <a href="#pressed"><b>pressed</b></a> ( QIconViewItem * item )</li>
|
---|
114 | <li class=fn>void <a href="#pressed-2"><b>pressed</b></a> ( QIconViewItem * item, const QPoint & pos )</li>
|
---|
115 | <li class=fn>void <a href="#doubleClicked"><b>doubleClicked</b></a> ( QIconViewItem * item )</li>
|
---|
116 | <li class=fn>void <a href="#returnPressed"><b>returnPressed</b></a> ( QIconViewItem * item )</li>
|
---|
117 | <li class=fn>void <a href="#rightButtonClicked"><b>rightButtonClicked</b></a> ( QIconViewItem * item, const QPoint & pos )</li>
|
---|
118 | <li class=fn>void <a href="#rightButtonPressed"><b>rightButtonPressed</b></a> ( QIconViewItem * item, const QPoint & pos )</li>
|
---|
119 | <li class=fn>void <a href="#mouseButtonPressed"><b>mouseButtonPressed</b></a> ( int button, QIconViewItem * item, const QPoint & pos )</li>
|
---|
120 | <li class=fn>void <a href="#mouseButtonClicked"><b>mouseButtonClicked</b></a> ( int button, QIconViewItem * item, const QPoint & pos )</li>
|
---|
121 | <li class=fn>void <a href="#contextMenuRequested"><b>contextMenuRequested</b></a> ( QIconViewItem * item, const QPoint & pos )</li>
|
---|
122 | <li class=fn>void <a href="#dropped"><b>dropped</b></a> ( QDropEvent * e, const QValueList<QIconDragItem> & lst )</li>
|
---|
123 | <li class=fn>void <a href="#moved"><b>moved</b></a> ()</li>
|
---|
124 | <li class=fn>void <a href="#onItem"><b>onItem</b></a> ( QIconViewItem * item )</li>
|
---|
125 | <li class=fn>void <a href="#onViewport"><b>onViewport</b></a> ()</li>
|
---|
126 | <li class=fn>void <a href="#itemRenamed"><b>itemRenamed</b></a> ( QIconViewItem * item, const QString & name )</li>
|
---|
127 | <li class=fn>void <a href="#itemRenamed-2"><b>itemRenamed</b></a> ( QIconViewItem * item )</li>
|
---|
128 | </ul>
|
---|
129 | <h2>Properties</h2>
|
---|
130 | <ul>
|
---|
131 | <li class=fn>Arrangement <a href="#arrangement-prop"><b>arrangement</b></a> - the arrangement mode of the icon view</li>
|
---|
132 | <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>
|
---|
133 | <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>
|
---|
134 | <li class=fn>int <a href="#gridX-prop"><b>gridX</b></a> - the horizontal grid of the icon view</li>
|
---|
135 | <li class=fn>int <a href="#gridY-prop"><b>gridY</b></a> - the vertical grid of the icon view</li>
|
---|
136 | <li class=fn>QBrush <a href="#itemTextBackground-prop"><b>itemTextBackground</b></a> - the brush to use when drawing the background of an item's text</li>
|
---|
137 | <li class=fn>ItemTextPos <a href="#itemTextPos-prop"><b>itemTextPos</b></a> - the position where the text of each item is drawn</li>
|
---|
138 | <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>
|
---|
139 | <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>
|
---|
140 | <li class=fn>int <a href="#maxItemWidth-prop"><b>maxItemWidth</b></a> - the maximum width that an item may have</li>
|
---|
141 | <li class=fn>ResizeMode <a href="#resizeMode-prop"><b>resizeMode</b></a> - the resize mode of the icon view</li>
|
---|
142 | <li class=fn>SelectionMode <a href="#selectionMode-prop"><b>selectionMode</b></a> - the selection mode of the icon view</li>
|
---|
143 | <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>
|
---|
144 | <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>
|
---|
145 | <li class=fn>bool <a href="#sorting-prop"><b>sorting</b></a> - whether the icon view sorts on insertion <em>(read only)</em></li>
|
---|
146 | <li class=fn>int <a href="#spacing-prop"><b>spacing</b></a> - the space in pixels between icon view items</li>
|
---|
147 | <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>
|
---|
148 | </ul>
|
---|
149 | <h2>Protected Members</h2>
|
---|
150 | <ul>
|
---|
151 | <li class=fn>virtual void <a href="#drawRubber"><b>drawRubber</b></a> ( QPainter * p )</li>
|
---|
152 | <li class=fn>virtual QDragObject * <a href="#dragObject"><b>dragObject</b></a> ()</li>
|
---|
153 | <li class=fn>virtual void <a href="#startDrag"><b>startDrag</b></a> ()</li>
|
---|
154 | <li class=fn>virtual void <a href="#insertInGrid"><b>insertInGrid</b></a> ( QIconViewItem * item )</li>
|
---|
155 | <li class=fn>virtual void <a href="#drawBackground"><b>drawBackground</b></a> ( QPainter * p, const QRect & r )</li>
|
---|
156 | <li class=fn>void <a href="#emitSelectionChanged"><b>emitSelectionChanged</b></a> ( QIconViewItem * i = 0 )</li>
|
---|
157 | <li class=fn>QIconViewItem * <a href="#makeRowLayout"><b>makeRowLayout</b></a> ( QIconViewItem * begin, int & y, bool & changed )</li>
|
---|
158 | </ul>
|
---|
159 | <h2>Protected Slots</h2>
|
---|
160 | <ul>
|
---|
161 | <li class=fn>virtual void <a href="#doAutoScroll"><b>doAutoScroll</b></a> ()</li>
|
---|
162 | <li class=fn>virtual void <a href="#adjustItems"><b>adjustItems</b></a> ()</li>
|
---|
163 | <li class=fn>virtual void <a href="#slotUpdate"><b>slotUpdate</b></a> ()</li>
|
---|
164 | </ul>
|
---|
165 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
166 |
|
---|
167 |
|
---|
168 | The QIconView class provides an area with movable labelled icons.
|
---|
169 | <p>
|
---|
170 |
|
---|
171 |
|
---|
172 | <p> A QIconView can display and manage a grid or other 2D layout of
|
---|
173 | labelled icons. Each labelled icon is a <a href="qiconviewitem.html">QIconViewItem</a>. Items
|
---|
174 | (QIconViewItems) can be added or deleted at any time; items can be
|
---|
175 | moved within the QIconView. Single or multiple items can be
|
---|
176 | selected. Items can be renamed in-place. QIconView also supports
|
---|
177 | <a href="#draganddrop">drag and drop</a>.
|
---|
178 | <p> Each item contains a label string, a pixmap or picture (the icon
|
---|
179 | itself) and optionally a sort key. The sort key is used for
|
---|
180 | sorting the items and defaults to the label string. The label
|
---|
181 | string can be displayed below or to the right of the icon (see <a href="#ItemTextPos-enum">ItemTextPos</a>).
|
---|
182 | <p> The simplest way to create a QIconView is to create a QIconView
|
---|
183 | object and create some QIconViewItems with the QIconView as their
|
---|
184 | parent, set the icon view's geometry and show it.
|
---|
185 | For example:
|
---|
186 | <pre>
|
---|
187 | QIconView *iv = new QIconView( this );
|
---|
188 | <a href="qdir.html">QDir</a> dir( path, "*.xpm" );
|
---|
189 | for ( uint i = 0; i < dir.<a href="qdir.html#count">count</a>(); i++ ) {
|
---|
190 | (void) new <a href="qiconviewitem.html">QIconViewItem</a>( iv, dir[i], QPixmap( path + dir[i] ) );
|
---|
191 | }
|
---|
192 | iv-><a href="qwidget.html#resize">resize</a>( 600, 400 );
|
---|
193 | iv-><a href="qwidget.html#show">show</a>();
|
---|
194 | </pre>
|
---|
195 |
|
---|
196 | <p> The <a href="qiconviewitem.html">QIconViewItem</a> call passes a pointer to the QIconView we wish to
|
---|
197 | populate, along with the label text and a <a href="qpixmap.html">QPixmap</a>.
|
---|
198 | <p> When an item is inserted the QIconView allocates a position for it.
|
---|
199 | Existing items are rearranged if <a href="#autoArrange">autoArrange</a>() is TRUE. The
|
---|
200 | default arrangement is <a href="#Arrangement-enum">LeftToRight</a> -- the QIconView fills up
|
---|
201 | the <em>left-most</em> column from top to bottom, then moves one column
|
---|
202 | <em>right</em> and fills that from top to bottom and so on. The
|
---|
203 | arrangement can be modified with any of the following approaches:
|
---|
204 | <ul>
|
---|
205 | <li> Call <a href="#setArrangement">setArrangement</a>(), e.g. with <a href="#Arrangement-enum">TopToBottom</a> which will fill
|
---|
206 | the <em>top-most</em> row from left to right, then moves one row <em>down</em>
|
---|
207 | and fills that row from left to right and so on.
|
---|
208 | <li> Construct each QIconViewItem using a constructor which allows
|
---|
209 | you to specify which item the new one is to follow.
|
---|
210 | <li> Call <a href="#setSorting">setSorting</a>() or <a href="#sort">sort</a>() to sort the items.
|
---|
211 | </ul>
|
---|
212 | <p> The spacing between items is set with <a href="#setSpacing">setSpacing</a>(). Items can be
|
---|
213 | laid out using a fixed grid using <a href="#setGridX">setGridX</a>() and <a href="#setGridY">setGridY</a>(); by
|
---|
214 | default the QIconView calculates a grid dynamically. The position
|
---|
215 | of items' label text is set with <a href="#setItemTextPos">setItemTextPos</a>(). The text's
|
---|
216 | background can be set with <a href="#setItemTextBackground">setItemTextBackground</a>(). The maximum
|
---|
217 | width of an item and of its text are set with <a href="#setMaxItemWidth">setMaxItemWidth</a>()
|
---|
218 | and <a href="#setMaxItemTextLength">setMaxItemTextLength</a>(). The label text will be word-wrapped if
|
---|
219 | it is too long; this is controlled by <a href="#setWordWrapIconText">setWordWrapIconText</a>(). If
|
---|
220 | the label text is truncated, the user can still see the entire
|
---|
221 | text in a tool tip if they hover the mouse over the item. This is
|
---|
222 | controlled with <a href="#setShowToolTips">setShowToolTips</a>().
|
---|
223 | <p> Items which are <a href="qiconviewitem.html#isSelectable">selectable</a> may be selected depending on the SelectionMode;
|
---|
224 | the default is <a href="#SelectionMode-enum">Single</a>. Because QIconView offers multiple
|
---|
225 | selection it must display <a href="focus.html#keyboard-focus">keyboard focus</a> and selection state
|
---|
226 | separately. Therefore there are functions to set the selection
|
---|
227 | state of an item (<a href="#setSelected">setSelected</a>()) and to select which item displays
|
---|
228 | keyboard focus (<a href="#setCurrentItem">setCurrentItem</a>()). When multiple items may be
|
---|
229 | selected the icon view provides a rubberband, too.
|
---|
230 | <p> When in-place renaming is enabled (it is disabled by default), the
|
---|
231 | user may change the item's label. They do this by selecting the item
|
---|
232 | (single clicking it or navigating to it with the arrow keys), then
|
---|
233 | single clicking it (or pressing F2), and entering their text. If no
|
---|
234 | key has been set with <a href="qiconviewitem.html#setKey">QIconViewItem::setKey</a>() the new text will also
|
---|
235 | serve as the key. (See <a href="qiconviewitem.html#setRenameEnabled">QIconViewItem::setRenameEnabled</a>().)
|
---|
236 | <p> You can control whether users can move items themselves with
|
---|
237 | <a href="#setItemsMovable">setItemsMovable</a>().
|
---|
238 | <p> Because the internal structure used to store the icon view items is
|
---|
239 | linear, no iterator class is needed to iterate over all the items.
|
---|
240 | Instead we iterate by getting the first item from the <em>icon view</em>
|
---|
241 | and then each subsequent (<a href="qiconviewitem.html#nextItem">QIconViewItem::nextItem</a>()) from each
|
---|
242 | <em>item</em> in turn:
|
---|
243 | <pre>
|
---|
244 | for ( <a href="qiconviewitem.html">QIconViewItem</a> *item = iv->firstItem(); item; item = item-><a href="qiconviewitem.html#nextItem">nextItem</a>() )
|
---|
245 | do_something( item );
|
---|
246 | </pre>
|
---|
247 |
|
---|
248 | QIconView also provides <a href="#currentItem">currentItem</a>(). You can search for an item
|
---|
249 | using <a href="#findItem">findItem</a>() (searching by position or for label text) and
|
---|
250 | with <a href="#findFirstVisibleItem">findFirstVisibleItem</a>() and <a href="#findLastVisibleItem">findLastVisibleItem</a>(). The number
|
---|
251 | of items is returned by <a href="#count">count</a>(). An item can be removed from an
|
---|
252 | icon view using <a href="#takeItem">takeItem</a>(); to delete an item use <tt>delete</tt>. All
|
---|
253 | the items can be deleted with <a href="#clear">clear</a>().
|
---|
254 | <p> The QIconView emits a wide range of useful signals, including
|
---|
255 | <a href="#selectionChanged">selectionChanged</a>(), <a href="#currentChanged">currentChanged</a>(), <a href="#clicked">clicked</a>(), <a href="#moved">moved</a>() and
|
---|
256 | <a href="#itemRenamed">itemRenamed</a>().
|
---|
257 | <p> <a name="draganddrop"></a>
|
---|
258 | <h3> Drag and Drop
|
---|
259 | </h3>
|
---|
260 | <a name="1"></a><p> QIconView supports the drag and drop of items within the QIconView
|
---|
261 | itself. It also supports the drag and drop of items out of or into
|
---|
262 | the QIconView and drag and drop onto items themselves. The drag and
|
---|
263 | drop of items outside the QIconView can be achieved in a simple way
|
---|
264 | with basic functionality, or in a more sophisticated way which
|
---|
265 | provides more power and control.
|
---|
266 | <p> The simple approach to dragging items out of the icon view is to
|
---|
267 | subclass QIconView and reimplement <a href="#dragObject">QIconView::dragObject</a>().
|
---|
268 | <p> <pre>
|
---|
269 | QDragObject *MyIconView::dragObject()
|
---|
270 | {
|
---|
271 | return new <a href="qtextdrag.html">QTextDrag</a>( <a href="#currentItem">currentItem</a>()->text(), this );
|
---|
272 | }
|
---|
273 | </pre>
|
---|
274 |
|
---|
275 | <p> In this example we create a <a href="qtextdrag.html">QTextDrag</a> object, (derived from
|
---|
276 | <a href="qdragobject.html">QDragObject</a>), containing the item's label and return it as the drag
|
---|
277 | object. We could just as easily have created a <a href="qimagedrag.html">QImageDrag</a> from the
|
---|
278 | item's pixmap and returned that instead.
|
---|
279 | <p> QIconViews and their QIconViewItems can also be the targets of drag
|
---|
280 | and drops. To make the QIconView itself able to accept drops connect
|
---|
281 | to the <a href="#dropped">dropped</a>() signal. When a drop occurs this signal will be
|
---|
282 | emitted with a QDragEvent and a <a href="qvaluelist.html">QValueList</a> of QIconDragItems. To
|
---|
283 | make a <a href="qiconviewitem.html">QIconViewItem</a> into a drop target subclass QIconViewItem and
|
---|
284 | reimplement <a href="qiconviewitem.html#acceptDrop">QIconViewItem::acceptDrop</a>() and
|
---|
285 | <a href="qiconviewitem.html#dropped">QIconViewItem::dropped</a>().
|
---|
286 | <p> <pre>
|
---|
287 | bool MyIconViewItem::acceptDrop( const <a href="qmimesource.html">QMimeSource</a> *mime ) const
|
---|
288 | {
|
---|
289 | if ( mime-><a href="qmimesource.html#provides">provides</a>( "text/plain" ) )
|
---|
290 | return TRUE;
|
---|
291 | return FALSE;
|
---|
292 | }
|
---|
293 |
|
---|
294 | void MyIconViewItem::dropped( <a href="qdropevent.html">QDropEvent</a> *evt, const <a href="qvaluelist.html">QValueList</a><QIconDragItem>& )
|
---|
295 | {
|
---|
296 | <a href="qstring.html">QString</a> label;
|
---|
297 | if ( QTextDrag::<a href="qtextdrag.html#decode">decode</a>( evt, label ) )
|
---|
298 | setText( label );
|
---|
299 | }
|
---|
300 | </pre>
|
---|
301 |
|
---|
302 | <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
|
---|
303 | which demonstrates drag and drop between a QIconView and a
|
---|
304 | <a href="qlistbox.html">QListBox</a>.
|
---|
305 | <p> If you want to use extended drag-and-drop or have drag shapes drawn
|
---|
306 | you must take a more sophisticated approach.
|
---|
307 | <p> The first part is starting drags -- you should use a <a href="qicondrag.html">QIconDrag</a> (or a
|
---|
308 | class derived from it) for the drag object. In <a href="#dragObject">dragObject</a>() create the
|
---|
309 | drag object, populate it with QIconDragItems and return it. Normally
|
---|
310 | such a drag should offer each selected item's data. So in dragObject()
|
---|
311 | you should iterate over all the items, and create a <a href="qicondragitem.html">QIconDragItem</a> for
|
---|
312 | each selected item, and append these items with <a href="qicondrag.html#append">QIconDrag::append</a>() to
|
---|
313 | the QIconDrag object. You can use <a href="qicondragitem.html#setData">QIconDragItem::setData</a>() to set the
|
---|
314 | data of each item that should be dragged. If you want to offer the
|
---|
315 | data in additional mime-types, it's best to use a class derived from
|
---|
316 | QIconDrag, which implements additional encoding and decoding
|
---|
317 | functions.
|
---|
318 | <p> When a drag enters the icon view, there is little to do. Simply
|
---|
319 | connect to the <a href="#dropped">dropped</a>() signal and reimplement
|
---|
320 | <a href="qiconviewitem.html#acceptDrop">QIconViewItem::acceptDrop</a>() and <a href="qiconviewitem.html#dropped">QIconViewItem::dropped</a>(). If you've
|
---|
321 | used a <a href="qicondrag.html">QIconDrag</a> (or a subclass of it) the second argument to the
|
---|
322 | dropped signal contains a <a href="qvaluelist.html">QValueList</a> of QIconDragItems -- you can
|
---|
323 | access their data by calling <a href="qicondragitem.html#data">QIconDragItem::data</a>() on each one.
|
---|
324 | <p> For an example implementation of complex drag-and-drop look at the
|
---|
325 | fileiconview example (qt/examples/fileiconview).
|
---|
326 | <p> <p>See also <a href="qiconviewitem.html#setDragEnabled">QIconViewItem::setDragEnabled</a>(), <a href="qiconviewitem.html#setDropEnabled">QIconViewItem::setDropEnabled</a>(), <a href="qiconviewitem.html#acceptDrop">QIconViewItem::acceptDrop</a>(), <a href="qiconviewitem.html#dropped">QIconViewItem::dropped</a>(), and <a href="advanced.html">Advanced Widgets</a>.
|
---|
327 |
|
---|
328 | <p> <img src=qiconview-m.png> <img src=qiconview-w.png>
|
---|
329 |
|
---|
330 | <hr><h2>Member Type Documentation</h2>
|
---|
331 | <h3 class=fn><a name="Arrangement-enum"></a>QIconView::Arrangement</h3>
|
---|
332 |
|
---|
333 | <p> This enum type determines in which direction the items flow when
|
---|
334 | the view runs out of space.
|
---|
335 | <ul>
|
---|
336 | <li><tt>QIconView::LeftToRight</tt> - Items which don't fit into the view cause the
|
---|
337 | viewport to extend vertically (you get a vertical scrollbar).
|
---|
338 | <li><tt>QIconView::TopToBottom</tt> - Items which don't fit into the view cause the
|
---|
339 | viewport to extend horizontally (you get a horizontal scrollbar).
|
---|
340 | </ul>
|
---|
341 | <h3 class=fn><a name="ItemTextPos-enum"></a>QIconView::ItemTextPos</h3>
|
---|
342 |
|
---|
343 | <p> This enum type specifies the position of the item text in relation
|
---|
344 | to the icon.
|
---|
345 | <ul>
|
---|
346 | <li><tt>QIconView::Bottom</tt> - The text is drawn below the icon.
|
---|
347 | <li><tt>QIconView::Right</tt> - The text is drawn to the right of the icon.
|
---|
348 | </ul>
|
---|
349 | <h3 class=fn><a name="ResizeMode-enum"></a>QIconView::ResizeMode</h3>
|
---|
350 | <p> This enum type is used to tell QIconView how it should treat the
|
---|
351 | positions of its icons when the widget is resized. The modes are:
|
---|
352 | <ul>
|
---|
353 | <li><tt>QIconView::Fixed</tt> - The icons' positions are not changed.
|
---|
354 | <li><tt>QIconView::Adjust</tt> - The icons' positions are adjusted to be within the
|
---|
355 | new geometry, if possible.
|
---|
356 | </ul>
|
---|
357 | <h3 class=fn><a name="SelectionMode-enum"></a>QIconView::SelectionMode</h3>
|
---|
358 |
|
---|
359 | <p> This enumerated type is used by QIconView to indicate how it
|
---|
360 | reacts to selection by the user. It has four values:
|
---|
361 | <ul>
|
---|
362 | <li><tt>QIconView::Single</tt> - When the user selects an item, any already-selected
|
---|
363 | item becomes unselected and the user cannot unselect the selected
|
---|
364 | item. This means that the user can never clear the selection. (The
|
---|
365 | application programmer can, using <a href="#clearSelection">QIconView::clearSelection</a>().)
|
---|
366 | <li><tt>QIconView::Multi</tt> - When the user selects an item, e.g. by navigating
|
---|
367 | to it with the keyboard arrow keys or by clicking it, the
|
---|
368 | selection status of that item is toggled and the other items are
|
---|
369 | left alone. Also, multiple items can be selected by dragging the
|
---|
370 | mouse while the left mouse button stays pressed.
|
---|
371 | <li><tt>QIconView::Extended</tt> - When the user selects an item the selection is
|
---|
372 | cleared and the new item selected. However, if the user presses
|
---|
373 | the Ctrl key when clicking on an item, the clicked item gets
|
---|
374 | toggled and all other items are left untouched. If the user
|
---|
375 | presses the Shift key while clicking on an item, all items between
|
---|
376 | the current item and the clicked item get selected or unselected,
|
---|
377 | depending on the state of the clicked item. Also, multiple items
|
---|
378 | can be selected by dragging the mouse while the left mouse button
|
---|
379 | stays pressed.
|
---|
380 | <li><tt>QIconView::NoSelection</tt> - Items cannot be selected.
|
---|
381 | </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
|
---|
382 | view in which users can select multiple items but usually want to
|
---|
383 | 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
|
---|
384 | not touch.
|
---|
385 |
|
---|
386 | <hr><h2>Member Function Documentation</h2>
|
---|
387 | <h3 class=fn><a name="QIconView"></a>QIconView::QIconView ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0, WFlags f = 0 )
|
---|
388 | </h3>
|
---|
389 | Constructs an empty icon view called <em>name</em>, with parent <em>parent</em> and using the widget flags <em>f</em>.
|
---|
390 |
|
---|
391 | <h3 class=fn><a name="~QIconView"></a>QIconView::~QIconView ()<tt> [virtual]</tt>
|
---|
392 | </h3>
|
---|
393 | Destroys the icon view and deletes all items.
|
---|
394 |
|
---|
395 | <h3 class=fn>void <a name="adjustItems"></a>QIconView::adjustItems ()<tt> [virtual protected slot]</tt>
|
---|
396 | </h3>
|
---|
397 | Adjusts the positions of the items to the geometry of the icon
|
---|
398 | view.
|
---|
399 |
|
---|
400 | <h3 class=fn>void <a name="arrangeItemsInGrid"></a>QIconView::arrangeItemsInGrid ( const <a href="qsize.html">QSize</a> & grid, bool update = TRUE )<tt> [virtual slot]</tt>
|
---|
401 | </h3>
|
---|
402 | 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="qsize.html#isValid">QSize::isValid</a>()), <a href="#arrangeItemsInGrid">arrangeItemsInGrid</a>()
|
---|
403 | calculates a valid grid itself and uses that.
|
---|
404 | <p> If <em>update</em> is TRUE (the default) the viewport is repainted.
|
---|
405 |
|
---|
406 | <p>Example: <a href="fileiconview-example.html#x807">fileiconview/qfileiconview.h</a>.
|
---|
407 | <h3 class=fn>void <a name="arrangeItemsInGrid-2"></a>QIconView::arrangeItemsInGrid ( bool update = TRUE )<tt> [virtual slot]</tt>
|
---|
408 | </h3>
|
---|
409 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
410 | <p> Arranges all the items in the grid given by <a href="#gridX">gridX</a>() and <a href="#gridY">gridY</a>().
|
---|
411 | <p> Even if <a href="#sorting">sorting</a>() is enabled, the items are not sorted by this
|
---|
412 | function. If you want to sort or rearrange the items, use
|
---|
413 | iconview->sort(iconview->sortDirection()).
|
---|
414 | <p> If <em>update</em> is TRUE (the default), the viewport is repainted as
|
---|
415 | well.
|
---|
416 | <p> <p>See also <a href="#gridX-prop">QIconView::gridX</a>, <a href="#gridY-prop">QIconView::gridY</a>, and <a href="#sort">QIconView::sort</a>().
|
---|
417 |
|
---|
418 | <h3 class=fn><a href="qiconview.html#Arrangement-enum">Arrangement</a> <a name="arrangement"></a>QIconView::arrangement () const
|
---|
419 | </h3><p>Returns the arrangement mode of the icon view.
|
---|
420 | See the <a href="qiconview.html#arrangement-prop">"arrangement"</a> property for details.
|
---|
421 | <h3 class=fn>bool <a name="autoArrange"></a>QIconView::autoArrange () const
|
---|
422 | </h3><p>Returns TRUE if the icon view rearranges its items when a new item is inserted; otherwise returns FALSE.
|
---|
423 | See the <a href="qiconview.html#autoArrange-prop">"autoArrange"</a> property for details.
|
---|
424 | <h3 class=fn>void <a name="clear"></a>QIconView::clear ()<tt> [virtual]</tt>
|
---|
425 | </h3>
|
---|
426 | Clears the icon view. All items are deleted.
|
---|
427 |
|
---|
428 | <h3 class=fn>void <a name="clearSelection"></a>QIconView::clearSelection ()<tt> [virtual]</tt>
|
---|
429 | </h3>
|
---|
430 | Unselects all the items.
|
---|
431 |
|
---|
432 | <h3 class=fn>void <a name="clicked"></a>QIconView::clicked ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [signal]</tt>
|
---|
433 | </h3>
|
---|
434 |
|
---|
435 | <p> This signal is emitted when the user clicks any mouse button. If
|
---|
436 | <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null,
|
---|
437 | the mouse cursor isn't on any item.
|
---|
438 | <p> <p>See also <a href="#mouseButtonClicked">mouseButtonClicked</a>(), <a href="#rightButtonClicked">rightButtonClicked</a>(), and <a href="#pressed">pressed</a>().
|
---|
439 |
|
---|
440 | <h3 class=fn>void <a name="clicked-2"></a>QIconView::clicked ( <a href="qiconviewitem.html">QIconViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
|
---|
441 | </h3>
|
---|
442 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
443 | <p> This signal is emitted when the user clicks any mouse button on an
|
---|
444 | icon view item. <em>item</em> is a pointer to the item that has been
|
---|
445 | clicked.
|
---|
446 | <p> <em>pos</em> is the position of the mouse cursor in the global coordinate
|
---|
447 | system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's press and release
|
---|
448 | differ by a pixel or two, <em>pos</em> is the position at release time.)
|
---|
449 | <p> <p>See also <a href="#mouseButtonClicked">mouseButtonClicked</a>(), <a href="#rightButtonClicked">rightButtonClicked</a>(), and <a href="#pressed">pressed</a>().
|
---|
450 |
|
---|
451 | <h3 class=fn>void <a name="contextMenuRequested"></a>QIconView::contextMenuRequested ( <a href="qiconviewitem.html">QIconViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
|
---|
452 | </h3>
|
---|
453 |
|
---|
454 | <p> This signal is emitted when the user invokes a context menu with
|
---|
455 | the right mouse button or with special system keys, with <em>item</em>
|
---|
456 | being the item under the mouse cursor or the current item,
|
---|
457 | respectively.
|
---|
458 | <p> <em>pos</em> is the position for the context menu in the global
|
---|
459 | coordinate system.
|
---|
460 |
|
---|
461 | <h3 class=fn>uint <a name="count"></a>QIconView::count () const
|
---|
462 | </h3><p>Returns the number of items in the icon view.
|
---|
463 | See the <a href="qiconview.html#count-prop">"count"</a> property for details.
|
---|
464 | <h3 class=fn>void <a name="currentChanged"></a>QIconView::currentChanged ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [signal]</tt>
|
---|
465 | </h3>
|
---|
466 |
|
---|
467 | <p> This signal is emitted when a new item becomes current. <em>item</em> is
|
---|
468 | the new current item (or 0 if no item is now current).
|
---|
469 | <p> <p>See also <a href="#currentItem">currentItem</a>().
|
---|
470 |
|
---|
471 | <h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a> * <a name="currentItem"></a>QIconView::currentItem () const
|
---|
472 | </h3>
|
---|
473 | Returns a pointer to the current item of the icon view, or 0 if no
|
---|
474 | item is current.
|
---|
475 | <p> <p>See also <a href="#setCurrentItem">setCurrentItem</a>(), <a href="#firstItem">firstItem</a>(), and <a href="#lastItem">lastItem</a>().
|
---|
476 |
|
---|
477 | <h3 class=fn>void <a name="doAutoScroll"></a>QIconView::doAutoScroll ()<tt> [virtual protected slot]</tt>
|
---|
478 | </h3>
|
---|
479 | Performs autoscrolling when selecting multiple icons with the
|
---|
480 | rubber band.
|
---|
481 |
|
---|
482 | <h3 class=fn>void <a name="doubleClicked"></a>QIconView::doubleClicked ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [signal]</tt>
|
---|
483 | </h3>
|
---|
484 |
|
---|
485 | <p> This signal is emitted when the user double-clicks on <em>item</em>.
|
---|
486 |
|
---|
487 | <h3 class=fn><a href="qdragobject.html">QDragObject</a> * <a name="dragObject"></a>QIconView::dragObject ()<tt> [virtual protected]</tt>
|
---|
488 | </h3>
|
---|
489 | Returns the <a href="qdragobject.html">QDragObject</a> that should be used for drag-and-drop.
|
---|
490 | This function is called by the icon view when starting a drag to
|
---|
491 | get the dragobject that should be used for the drag. Subclasses
|
---|
492 | may reimplement this.
|
---|
493 | <p> <p>See also <a href="qicondrag.html">QIconDrag</a>.
|
---|
494 |
|
---|
495 | <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>.
|
---|
496 | <h3 class=fn>void <a name="drawBackground"></a>QIconView::drawBackground ( <a href="qpainter.html">QPainter</a> * p, const <a href="qrect.html">QRect</a> & r )<tt> [virtual protected]</tt>
|
---|
497 | </h3>
|
---|
498 | This function is called to draw the rectangle <em>r</em> of the
|
---|
499 | background using the painter <em>p</em>.
|
---|
500 | <p> The default implementation fills <em>r</em> with the viewport's
|
---|
501 | <a href="qwidget.html#backgroundBrush">backgroundBrush</a>(). Subclasses may reimplement this to draw custom
|
---|
502 | backgrounds.
|
---|
503 | <p> <p>See also <a href="qscrollview.html#contentsX-prop">contentsX</a>, <a href="qscrollview.html#contentsY-prop">contentsY</a>, and <a href="qscrollview.html#drawContents">drawContents</a>().
|
---|
504 |
|
---|
505 | <h3 class=fn>void <a name="drawRubber"></a>QIconView::drawRubber ( <a href="qpainter.html">QPainter</a> * p )<tt> [virtual protected]</tt>
|
---|
506 | </h3>
|
---|
507 | Draws the rubber band using the painter <em>p</em>.
|
---|
508 |
|
---|
509 | <h3 class=fn>void <a name="dropped"></a>QIconView::dropped ( <a href="qdropevent.html">QDropEvent</a> * e, const <a href="qvaluelist.html">QValueList</a><QIconDragItem> & lst )<tt> [signal]</tt>
|
---|
510 | </h3>
|
---|
511 |
|
---|
512 | <p> This signal is emitted when a drop event occurs in the viewport
|
---|
513 | (but not on any icon) which the icon view itself can't handle.
|
---|
514 | <p> <em>e</em> provides all the information about the drop. If the drag
|
---|
515 | object of the drop was a <a href="qicondrag.html">QIconDrag</a>, <em>lst</em> contains the list of
|
---|
516 | the dropped items. You can get the data using
|
---|
517 | <a href="qicondragitem.html#data">QIconDragItem::data</a>() on each item. If the <em>lst</em> is empty, i.e.
|
---|
518 | the drag was not a QIconDrag, you have to decode the data in <em>e</em>
|
---|
519 | and work with that.
|
---|
520 | <p> Note QIconViewItems may be drop targets; if a drop event occurs on
|
---|
521 | an item the item handles the drop.
|
---|
522 |
|
---|
523 | <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>.
|
---|
524 | <h3 class=fn>void <a name="emitSelectionChanged"></a>QIconView::emitSelectionChanged ( <a href="qiconviewitem.html">QIconViewItem</a> * i = 0 )<tt> [protected]</tt>
|
---|
525 | </h3>
|
---|
526 | Emits a signal to indicate selection changes. <em>i</em> is the
|
---|
527 | <a href="qiconviewitem.html">QIconViewItem</a> that was selected or de-selected.
|
---|
528 | <p> <em>You should never need to call this function.</em>
|
---|
529 |
|
---|
530 | <h3 class=fn>void <a name="ensureItemVisible"></a>QIconView::ensureItemVisible ( <a href="qiconviewitem.html">QIconViewItem</a> * item )
|
---|
531 | </h3>
|
---|
532 | Makes sure that <em>item</em> is entirely visible. If necessary,
|
---|
533 | <a href="#ensureItemVisible">ensureItemVisible</a>() scrolls the icon view.
|
---|
534 | <p> <p>See also <a href="qscrollview.html#ensureVisible">ensureVisible</a>().
|
---|
535 |
|
---|
536 | <h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a> * <a name="findFirstVisibleItem"></a>QIconView::findFirstVisibleItem ( const <a href="qrect.html">QRect</a> & r ) const
|
---|
537 | </h3>
|
---|
538 | Finds the first item whose bounding rectangle overlaps <em>r</em> and
|
---|
539 | returns a pointer to that item. <em>r</em> is given in content
|
---|
540 | coordinates. Returns 0 if no item overlaps <em>r</em>.
|
---|
541 | <p> If you want to find all items that touch <em>r</em>, you will need to
|
---|
542 | use this function and nextItem() in a loop ending at
|
---|
543 | <a href="#findLastVisibleItem">findLastVisibleItem</a>() and test <a href="qiconviewitem.html#rect">QIconViewItem::rect</a>() for each of
|
---|
544 | these items.
|
---|
545 | <p> <p>See also <a href="#findLastVisibleItem">findLastVisibleItem</a>() and <a href="qiconviewitem.html#rect">QIconViewItem::rect</a>().
|
---|
546 |
|
---|
547 | <h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a> * <a name="findItem"></a>QIconView::findItem ( const <a href="qpoint.html">QPoint</a> & pos ) const
|
---|
548 | </h3>
|
---|
549 | Returns a pointer to the item that contains point <em>pos</em>, which is
|
---|
550 | given in contents coordinates, or 0 if no item contains point <em>pos</em>.
|
---|
551 |
|
---|
552 | <h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a> * <a name="findItem-2"></a>QIconView::findItem ( const <a href="qstring.html">QString</a> & text, ComparisonFlags compare = BeginsWith ) const
|
---|
553 | </h3>
|
---|
554 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
555 | <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
|
---|
556 | to control the comparison behaviour. (See <a href="qt.html#StringComparisonMode-enum">Qt::StringComparisonMode</a>.)
|
---|
557 |
|
---|
558 | <h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a> * <a name="findLastVisibleItem"></a>QIconView::findLastVisibleItem ( const <a href="qrect.html">QRect</a> & r ) const
|
---|
559 | </h3>
|
---|
560 | Finds the last item whose bounding rectangle overlaps <em>r</em> and
|
---|
561 | returns a pointer to that item. <em>r</em> is given in content
|
---|
562 | coordinates. Returns 0 if no item overlaps <em>r</em>.
|
---|
563 | <p> <p>See also <a href="#findFirstVisibleItem">findFirstVisibleItem</a>().
|
---|
564 |
|
---|
565 | <h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a> * <a name="firstItem"></a>QIconView::firstItem () const
|
---|
566 | </h3>
|
---|
567 | Returns a pointer to the first item of the icon view, or 0 if
|
---|
568 | there are no items in the icon view.
|
---|
569 | <p> <p>See also <a href="#lastItem">lastItem</a>() and <a href="#currentItem">currentItem</a>().
|
---|
570 |
|
---|
571 | <h3 class=fn>int <a name="gridX"></a>QIconView::gridX () const
|
---|
572 | </h3><p>Returns the horizontal grid of the icon view.
|
---|
573 | See the <a href="qiconview.html#gridX-prop">"gridX"</a> property for details.
|
---|
574 | <h3 class=fn>int <a name="gridY"></a>QIconView::gridY () const
|
---|
575 | </h3><p>Returns the vertical grid of the icon view.
|
---|
576 | See the <a href="qiconview.html#gridY-prop">"gridY"</a> property for details.
|
---|
577 | <h3 class=fn>int <a name="index"></a>QIconView::index ( const <a href="qiconviewitem.html">QIconViewItem</a> * item ) const
|
---|
578 | </h3>
|
---|
579 | Returns the index of <em>item</em>, or -1 if <em>item</em> doesn't exist in
|
---|
580 | this icon view.
|
---|
581 |
|
---|
582 | <h3 class=fn>void <a name="insertInGrid"></a>QIconView::insertInGrid ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [virtual protected]</tt>
|
---|
583 | </h3>
|
---|
584 | Inserts the <a href="qiconviewitem.html">QIconViewItem</a> <em>item</em> in the icon view's grid. <em>You should never need to call this function.</em> Instead, insert
|
---|
585 | QIconViewItems by creating them with a pointer to the QIconView
|
---|
586 | that they are to be inserted into.
|
---|
587 |
|
---|
588 | <h3 class=fn>void <a name="insertItem"></a>QIconView::insertItem ( <a href="qiconviewitem.html">QIconViewItem</a> * item, <a href="qiconviewitem.html">QIconViewItem</a> * after = 0L )<tt> [virtual]</tt>
|
---|
589 | </h3>
|
---|
590 | Inserts the icon view item <em>item</em> after <em>after</em>. If <em>after</em> is
|
---|
591 | 0, <em>item</em> is appended after the last item.
|
---|
592 | <p> <em>You should never need to call this function.</em> Instead create
|
---|
593 | <a href="qiconviewitem.html">QIconViewItem</a>'s and associate them with your icon view like this:
|
---|
594 | <p> <pre>
|
---|
595 | (void) new <a href="qiconviewitem.html">QIconViewItem</a>( myIconview, "The text of the item", aPixmap );
|
---|
596 | </pre>
|
---|
597 |
|
---|
598 |
|
---|
599 | <h3 class=fn>void <a name="invertSelection"></a>QIconView::invertSelection ()<tt> [virtual]</tt>
|
---|
600 | </h3>
|
---|
601 | Inverts the selection. Works only in Multi and Extended selection
|
---|
602 | mode.
|
---|
603 |
|
---|
604 | <h3 class=fn>bool <a name="isRenaming"></a>QIconView::isRenaming () const
|
---|
605 | </h3>
|
---|
606 | Returns TRUE if an iconview item is being renamed; otherwise
|
---|
607 | returns FALSE.
|
---|
608 |
|
---|
609 | <h3 class=fn>void <a name="itemRenamed"></a>QIconView::itemRenamed ( <a href="qiconviewitem.html">QIconViewItem</a> * item, const <a href="qstring.html">QString</a> & name )<tt> [signal]</tt>
|
---|
610 | </h3>
|
---|
611 |
|
---|
612 | <p> This signal is emitted when <em>item</em> has been renamed to <em>name</em>,
|
---|
613 | usually by in-place renaming.
|
---|
614 | <p> <p>See also <a href="qiconviewitem.html#setRenameEnabled">QIconViewItem::setRenameEnabled</a>() and <a href="qiconviewitem.html#rename">QIconViewItem::rename</a>().
|
---|
615 |
|
---|
616 | <h3 class=fn>void <a name="itemRenamed-2"></a>QIconView::itemRenamed ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [signal]</tt>
|
---|
617 | </h3>
|
---|
618 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
619 | <p> This signal is emitted when <em>item</em> has been renamed, usually by
|
---|
620 | in-place renaming.
|
---|
621 | <p> <p>See also <a href="qiconviewitem.html#setRenameEnabled">QIconViewItem::setRenameEnabled</a>() and <a href="qiconviewitem.html#rename">QIconViewItem::rename</a>().
|
---|
622 |
|
---|
623 | <h3 class=fn><a href="qbrush.html">QBrush</a> <a name="itemTextBackground"></a>QIconView::itemTextBackground () const
|
---|
624 | </h3><p>Returns the brush to use when drawing the background of an item's text.
|
---|
625 | See the <a href="qiconview.html#itemTextBackground-prop">"itemTextBackground"</a> property for details.
|
---|
626 | <h3 class=fn><a href="qiconview.html#ItemTextPos-enum">ItemTextPos</a> <a name="itemTextPos"></a>QIconView::itemTextPos () const
|
---|
627 | </h3><p>Returns the position where the text of each item is drawn.
|
---|
628 | See the <a href="qiconview.html#itemTextPos-prop">"itemTextPos"</a> property for details.
|
---|
629 | <h3 class=fn>bool <a name="itemsMovable"></a>QIconView::itemsMovable () const
|
---|
630 | </h3><p>Returns TRUE if the user is allowed to move items around in the icon view; otherwise returns FALSE.
|
---|
631 | See the <a href="qiconview.html#itemsMovable-prop">"itemsMovable"</a> property for details.
|
---|
632 | <h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a> * <a name="lastItem"></a>QIconView::lastItem () const
|
---|
633 | </h3>
|
---|
634 | Returns a pointer to the last item of the icon view, or 0 if there
|
---|
635 | are no items in the icon view.
|
---|
636 | <p> <p>See also <a href="#firstItem">firstItem</a>() and <a href="#currentItem">currentItem</a>().
|
---|
637 |
|
---|
638 | <h3 class=fn><a href="qiconviewitem.html">QIconViewItem</a> * <a name="makeRowLayout"></a>QIconView::makeRowLayout ( <a href="qiconviewitem.html">QIconViewItem</a> * begin, int & y, bool & changed )<tt> [protected]</tt>
|
---|
639 | </h3>
|
---|
640 | Lays out a row of icons (if Arrangement == <a href="#Arrangement-enum">TopToBottom</a> this is
|
---|
641 | a column). Starts laying out with the item <em>begin</em>. <em>y</em> is the
|
---|
642 | starting coordinate. Returns the last item of the row (column) and
|
---|
643 | sets the new starting coordinate to <em>y</em>. The <em>changed</em> parameter
|
---|
644 | is used internally.
|
---|
645 | <p> <b>Warning:</b> This function may be made private in a future version of
|
---|
646 | Qt. We do not recommend calling it.
|
---|
647 |
|
---|
648 | <h3 class=fn>int <a name="maxItemTextLength"></a>QIconView::maxItemTextLength () const
|
---|
649 | </h3><p>Returns the maximum length (in characters) that an item's text may have.
|
---|
650 | See the <a href="qiconview.html#maxItemTextLength-prop">"maxItemTextLength"</a> property for details.
|
---|
651 | <h3 class=fn>int <a name="maxItemWidth"></a>QIconView::maxItemWidth () const
|
---|
652 | </h3><p>Returns the maximum width that an item may have.
|
---|
653 | See the <a href="qiconview.html#maxItemWidth-prop">"maxItemWidth"</a> property for details.
|
---|
654 | <h3 class=fn>void <a name="mouseButtonClicked"></a>QIconView::mouseButtonClicked ( int button, <a href="qiconviewitem.html">QIconViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
|
---|
655 | </h3>
|
---|
656 |
|
---|
657 | <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.
|
---|
658 | <p> <em>pos</em> is the position of the mouse cursor in the global
|
---|
659 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
|
---|
660 | press and release differ by a pixel or two, <em>pos</em> is the
|
---|
661 | position at release time.)
|
---|
662 | <p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonClicked">rightButtonClicked</a>(), and <a href="#clicked">clicked</a>().
|
---|
663 |
|
---|
664 | <h3 class=fn>void <a name="mouseButtonPressed"></a>QIconView::mouseButtonPressed ( int button, <a href="qiconviewitem.html">QIconViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
|
---|
665 | </h3>
|
---|
666 |
|
---|
667 | <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.
|
---|
668 | <p> <em>pos</em> is the position of the mouse cursor in the global
|
---|
669 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()).
|
---|
670 | <p> <p>See also <a href="#rightButtonClicked">rightButtonClicked</a>() and <a href="#pressed">pressed</a>().
|
---|
671 |
|
---|
672 | <h3 class=fn>void <a name="moved"></a>QIconView::moved ()<tt> [signal]</tt>
|
---|
673 | </h3>
|
---|
674 |
|
---|
675 | <p> This signal is emitted after successfully dropping one (or more)
|
---|
676 | items of the icon view. If the items should be removed, it's best
|
---|
677 | to do so in a slot connected to this signal.
|
---|
678 |
|
---|
679 | <p>Example: <a href="iconview-example.html#x1456">iconview/main.cpp</a>.
|
---|
680 | <h3 class=fn>void <a name="onItem"></a>QIconView::onItem ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [signal]</tt>
|
---|
681 | </h3>
|
---|
682 |
|
---|
683 | <p> This signal is emitted when the user moves the mouse cursor onto
|
---|
684 | an <em>item</em>, similar to the <a href="qwidget.html#enterEvent">QWidget::enterEvent</a>() function.
|
---|
685 |
|
---|
686 | <h3 class=fn>void <a name="onViewport"></a>QIconView::onViewport ()<tt> [signal]</tt>
|
---|
687 | </h3>
|
---|
688 |
|
---|
689 | <p> This signal is emitted when the user moves the mouse cursor from
|
---|
690 | an item to an empty part of the icon view.
|
---|
691 | <p> <p>See also <a href="#onItem">onItem</a>().
|
---|
692 |
|
---|
693 | <h3 class=fn>void <a name="pressed"></a>QIconView::pressed ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [signal]</tt>
|
---|
694 | </h3>
|
---|
695 |
|
---|
696 | <p> This signal is emitted when the user presses any mouse button. If
|
---|
697 | <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null,
|
---|
698 | the mouse cursor isn't on any item.
|
---|
699 | <p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonPressed">rightButtonPressed</a>(), and <a href="#clicked">clicked</a>().
|
---|
700 |
|
---|
701 | <h3 class=fn>void <a name="pressed-2"></a>QIconView::pressed ( <a href="qiconviewitem.html">QIconViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
|
---|
702 | </h3>
|
---|
703 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
704 | <p> This signal is emitted when the user presses any mouse button. If
|
---|
705 | <em>item</em> is non-null, the cursor is on <em>item</em>. If <em>item</em> is null,
|
---|
706 | the mouse cursor isn't on any item.
|
---|
707 | <p> <em>pos</em> is the position of the mouse cursor in the global
|
---|
708 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
|
---|
709 | press and release differ by a pixel or two, <em>pos</em> is the
|
---|
710 | position at release time.)
|
---|
711 | <p> <p>See also <a href="#mouseButtonPressed">mouseButtonPressed</a>(), <a href="#rightButtonPressed">rightButtonPressed</a>(), and <a href="#clicked">clicked</a>().
|
---|
712 |
|
---|
713 | <h3 class=fn>void <a name="repaintItem"></a>QIconView::repaintItem ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [virtual]</tt>
|
---|
714 | </h3>
|
---|
715 | Repaints the <em>item</em>.
|
---|
716 |
|
---|
717 | <h3 class=fn>void <a name="repaintSelectedItems"></a>QIconView::repaintSelectedItems ()
|
---|
718 | </h3>
|
---|
719 | Repaints the selected items.
|
---|
720 |
|
---|
721 | <h3 class=fn><a href="qiconview.html#ResizeMode-enum">ResizeMode</a> <a name="resizeMode"></a>QIconView::resizeMode () const
|
---|
722 | </h3><p>Returns the resize mode of the icon view.
|
---|
723 | See the <a href="qiconview.html#resizeMode-prop">"resizeMode"</a> property for details.
|
---|
724 | <h3 class=fn>void <a name="returnPressed"></a>QIconView::returnPressed ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [signal]</tt>
|
---|
725 | </h3>
|
---|
726 |
|
---|
727 | <p> This signal is emitted if the user presses the Return or Enter
|
---|
728 | key. <em>item</em> is the <a href="#currentItem">currentItem</a>() at the time of the keypress.
|
---|
729 |
|
---|
730 | <h3 class=fn>void <a name="rightButtonClicked"></a>QIconView::rightButtonClicked ( <a href="qiconviewitem.html">QIconViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
|
---|
731 | </h3>
|
---|
732 |
|
---|
733 | <p> This signal is emitted when the user clicks the right mouse
|
---|
734 | 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.
|
---|
735 | <p> <em>pos</em> is the position of the mouse cursor in the global
|
---|
736 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()). (If the click's
|
---|
737 | press and release differ by a pixel or two, <em>pos</em> is the
|
---|
738 | position at release time.)
|
---|
739 | <p> <p>See also <a href="#rightButtonPressed">rightButtonPressed</a>(), <a href="#mouseButtonClicked">mouseButtonClicked</a>(), and <a href="#clicked">clicked</a>().
|
---|
740 |
|
---|
741 | <h3 class=fn>void <a name="rightButtonPressed"></a>QIconView::rightButtonPressed ( <a href="qiconviewitem.html">QIconViewItem</a> * item, const <a href="qpoint.html">QPoint</a> & pos )<tt> [signal]</tt>
|
---|
742 | </h3>
|
---|
743 |
|
---|
744 | <p> This signal is emitted when the user presses the right mouse
|
---|
745 | 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.
|
---|
746 | <p> <em>pos</em> is the position of the mouse cursor in the global
|
---|
747 | coordinate system (<a href="qmouseevent.html#globalPos">QMouseEvent::globalPos</a>()).
|
---|
748 |
|
---|
749 | <h3 class=fn>void <a name="selectAll"></a>QIconView::selectAll ( bool select )<tt> [virtual]</tt>
|
---|
750 | </h3>
|
---|
751 | In Multi and Extended modes, this function sets all items to be
|
---|
752 | selected if <em>select</em> is TRUE, and to be unselected if <em>select</em>
|
---|
753 | is FALSE.
|
---|
754 | <p> In Single and NoSelection modes, this function only changes the
|
---|
755 | selection status of <a href="#currentItem">currentItem</a>().
|
---|
756 |
|
---|
757 | <h3 class=fn>void <a name="selectionChanged"></a>QIconView::selectionChanged ()<tt> [signal]</tt>
|
---|
758 | </h3>
|
---|
759 |
|
---|
760 | <p> This signal is emitted when the selection has been changed. It's
|
---|
761 | emitted in each selection mode.
|
---|
762 |
|
---|
763 | <h3 class=fn>void <a name="selectionChanged-2"></a>QIconView::selectionChanged ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [signal]</tt>
|
---|
764 | </h3>
|
---|
765 | This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
---|
766 | <p> This signal is emitted when the selection changes. <em>item</em> is the
|
---|
767 | newly selected item. This signal is emitted only in single
|
---|
768 | selection mode.
|
---|
769 |
|
---|
770 | <h3 class=fn><a href="qiconview.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode"></a>QIconView::selectionMode () const
|
---|
771 | </h3><p>Returns the selection mode of the icon view.
|
---|
772 | See the <a href="qiconview.html#selectionMode-prop">"selectionMode"</a> property for details.
|
---|
773 | <h3 class=fn>void <a name="setArrangement"></a>QIconView::setArrangement ( <a href="qiconview.html#Arrangement-enum">Arrangement</a> am )<tt> [virtual]</tt>
|
---|
774 | </h3><p>Sets the arrangement mode of the icon view to <em>am</em>.
|
---|
775 | See the <a href="qiconview.html#arrangement-prop">"arrangement"</a> property for details.
|
---|
776 | <h3 class=fn>void <a name="setAutoArrange"></a>QIconView::setAutoArrange ( bool b )<tt> [virtual]</tt>
|
---|
777 | </h3><p>Sets whether the icon view rearranges its items when a new item is inserted to <em>b</em>.
|
---|
778 | See the <a href="qiconview.html#autoArrange-prop">"autoArrange"</a> property for details.
|
---|
779 | <h3 class=fn>void <a name="setCurrentItem"></a>QIconView::setCurrentItem ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [virtual]</tt>
|
---|
780 | </h3>
|
---|
781 | Makes <em>item</em> the new current item of the icon view.
|
---|
782 |
|
---|
783 | <h3 class=fn>void <a name="setGridX"></a>QIconView::setGridX ( int rx )<tt> [virtual]</tt>
|
---|
784 | </h3><p>Sets the horizontal grid of the icon view to <em>rx</em>.
|
---|
785 | See the <a href="qiconview.html#gridX-prop">"gridX"</a> property for details.
|
---|
786 | <h3 class=fn>void <a name="setGridY"></a>QIconView::setGridY ( int ry )<tt> [virtual]</tt>
|
---|
787 | </h3><p>Sets the vertical grid of the icon view to <em>ry</em>.
|
---|
788 | See the <a href="qiconview.html#gridY-prop">"gridY"</a> property for details.
|
---|
789 | <h3 class=fn>void <a name="setItemTextBackground"></a>QIconView::setItemTextBackground ( const <a href="qbrush.html">QBrush</a> & b )<tt> [virtual]</tt>
|
---|
790 | </h3><p>Sets the brush to use when drawing the background of an item's text to <em>b</em>.
|
---|
791 | See the <a href="qiconview.html#itemTextBackground-prop">"itemTextBackground"</a> property for details.
|
---|
792 | <h3 class=fn>void <a name="setItemTextPos"></a>QIconView::setItemTextPos ( <a href="qiconview.html#ItemTextPos-enum">ItemTextPos</a> pos )<tt> [virtual]</tt>
|
---|
793 | </h3><p>Sets the position where the text of each item is drawn to <em>pos</em>.
|
---|
794 | See the <a href="qiconview.html#itemTextPos-prop">"itemTextPos"</a> property for details.
|
---|
795 | <h3 class=fn>void <a name="setItemsMovable"></a>QIconView::setItemsMovable ( bool b )<tt> [virtual]</tt>
|
---|
796 | </h3><p>Sets whether the user is allowed to move items around in the icon view to <em>b</em>.
|
---|
797 | See the <a href="qiconview.html#itemsMovable-prop">"itemsMovable"</a> property for details.
|
---|
798 | <h3 class=fn>void <a name="setMaxItemTextLength"></a>QIconView::setMaxItemTextLength ( int w )<tt> [virtual]</tt>
|
---|
799 | </h3><p>Sets the maximum length (in characters) that an item's text may have to <em>w</em>.
|
---|
800 | See the <a href="qiconview.html#maxItemTextLength-prop">"maxItemTextLength"</a> property for details.
|
---|
801 | <h3 class=fn>void <a name="setMaxItemWidth"></a>QIconView::setMaxItemWidth ( int w )<tt> [virtual]</tt>
|
---|
802 | </h3><p>Sets the maximum width that an item may have to <em>w</em>.
|
---|
803 | See the <a href="qiconview.html#maxItemWidth-prop">"maxItemWidth"</a> property for details.
|
---|
804 | <h3 class=fn>void <a name="setResizeMode"></a>QIconView::setResizeMode ( <a href="qiconview.html#ResizeMode-enum">ResizeMode</a> am )<tt> [virtual]</tt>
|
---|
805 | </h3><p>Sets the resize mode of the icon view to <em>am</em>.
|
---|
806 | See the <a href="qiconview.html#resizeMode-prop">"resizeMode"</a> property for details.
|
---|
807 | <h3 class=fn>void <a name="setSelected"></a>QIconView::setSelected ( <a href="qiconviewitem.html">QIconViewItem</a> * item, bool s, bool cb = FALSE )<tt> [virtual]</tt>
|
---|
808 | </h3>
|
---|
809 | Selects or unselects <em>item</em> depending on <em>s</em>, and may also
|
---|
810 | unselect other items, depending on <a href="#selectionMode">QIconView::selectionMode</a>() and
|
---|
811 | <em>cb</em>.
|
---|
812 | <p> If <em>s</em> is FALSE, <em>item</em> is unselected.
|
---|
813 | <p> If <em>s</em> is TRUE and QIconView::selectionMode() is <a href="#SelectionMode-enum">Single</a>, <em>item</em> is selected, and the item which was selected is unselected.
|
---|
814 | <p> If <em>s</em> is TRUE and QIconView::selectionMode() is <a href="#SelectionMode-enum">Extended</a>, <em>item</em> is selected. If <em>cb</em> is TRUE, the selection state of the
|
---|
815 | icon view's other items is left unchanged. If <em>cb</em> is FALSE (the
|
---|
816 | default) all other items are unselected.
|
---|
817 | <p> If <em>s</em> is TRUE and QIconView::selectionMode() is <a href="#SelectionMode-enum">Multi</a> <em>item</em>
|
---|
818 | is selected.
|
---|
819 | <p> Note that <em>cb</em> is used only if QIconView::selectionMode() is <a href="#SelectionMode-enum">Extended</a>. <em>cb</em> defaults to FALSE.
|
---|
820 | <p> All items whose selection status is changed repaint themselves.
|
---|
821 |
|
---|
822 | <h3 class=fn>void <a name="setSelectionMode"></a>QIconView::setSelectionMode ( <a href="qiconview.html#SelectionMode-enum">SelectionMode</a> m )<tt> [virtual]</tt>
|
---|
823 | </h3><p>Sets the selection mode of the icon view to <em>m</em>.
|
---|
824 | See the <a href="qiconview.html#selectionMode-prop">"selectionMode"</a> property for details.
|
---|
825 | <h3 class=fn>void <a name="setShowToolTips"></a>QIconView::setShowToolTips ( bool b )<tt> [virtual]</tt>
|
---|
826 | </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>.
|
---|
827 | See the <a href="qiconview.html#showToolTips-prop">"showToolTips"</a> property for details.
|
---|
828 | <h3 class=fn>void <a name="setSorting"></a>QIconView::setSorting ( bool sort, bool ascending = TRUE )
|
---|
829 | </h3>
|
---|
830 | If <em>sort</em> is TRUE, this function sets the icon view to sort items
|
---|
831 | when a new item is inserted. If <em>sort</em> is FALSE, the icon view
|
---|
832 | will not be sorted.
|
---|
833 | <p> Note that <a href="#autoArrange">autoArrange</a>() must be TRUE for sorting to take place.
|
---|
834 | <p> If <em>ascending</em> is TRUE (the default), items are sorted in
|
---|
835 | ascending order. If <em>ascending</em> is FALSE, items are sorted in
|
---|
836 | descending order.
|
---|
837 | <p> <a href="qiconviewitem.html#compare">QIconViewItem::compare</a>() is used to compare pairs of items. The
|
---|
838 | sorting is based on the items' keys; these default to the items'
|
---|
839 | text unless specifically set to something else.
|
---|
840 | <p> <p>See also <a href="#autoArrange-prop">QIconView::autoArrange</a>, <a href="#autoArrange-prop">QIconView::autoArrange</a>, <a href="#sortDirection-prop">sortDirection</a>, <a href="#sort">sort</a>(), and <a href="qiconviewitem.html#setKey">QIconViewItem::setKey</a>().
|
---|
841 |
|
---|
842 | <h3 class=fn>void <a name="setSpacing"></a>QIconView::setSpacing ( int sp )<tt> [virtual]</tt>
|
---|
843 | </h3><p>Sets the space in pixels between icon view items to <em>sp</em>.
|
---|
844 | See the <a href="qiconview.html#spacing-prop">"spacing"</a> property for details.
|
---|
845 | <h3 class=fn>void <a name="setWordWrapIconText"></a>QIconView::setWordWrapIconText ( bool b )<tt> [virtual]</tt>
|
---|
846 | </h3><p>Sets whether the item text will be word-wrapped if it is too long to <em>b</em>.
|
---|
847 | See the <a href="qiconview.html#wordWrapIconText-prop">"wordWrapIconText"</a> property for details.
|
---|
848 | <h3 class=fn>bool <a name="showToolTips"></a>QIconView::showToolTips () const
|
---|
849 | </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.
|
---|
850 | See the <a href="qiconview.html#showToolTips-prop">"showToolTips"</a> property for details.
|
---|
851 | <h3 class=fn>void <a name="slotUpdate"></a>QIconView::slotUpdate ()<tt> [virtual protected slot]</tt>
|
---|
852 | </h3>
|
---|
853 | This slot is used for a slightly-delayed update.
|
---|
854 | <p> The icon view is not redrawn immediately after inserting a new item
|
---|
855 | but after a very small delay using a <a href="qtimer.html">QTimer</a>. This means that when
|
---|
856 | many items are inserted in a loop the icon view is probably redrawn
|
---|
857 | only once at the end of the loop. This makes the insertions both
|
---|
858 | flicker-free and faster.
|
---|
859 |
|
---|
860 | <h3 class=fn>void <a name="sort"></a>QIconView::sort ( bool ascending = TRUE )<tt> [virtual]</tt>
|
---|
861 | </h3>
|
---|
862 | Sorts and rearranges all the items in the icon view. If <em>ascending</em> is TRUE, the items are sorted in increasing order,
|
---|
863 | otherwise they are sorted in decreasing order.
|
---|
864 | <p> <a href="qiconviewitem.html#compare">QIconViewItem::compare</a>() is used to compare pairs of items. The
|
---|
865 | sorting is based on the items' keys; these default to the items'
|
---|
866 | text unless specifically set to something else.
|
---|
867 | <p> Note that this function sets the sort order to <em>ascending</em>.
|
---|
868 | <p> <p>See also <a href="qiconviewitem.html#key">QIconViewItem::key</a>(), <a href="qiconviewitem.html#setKey">QIconViewItem::setKey</a>(), <a href="qiconviewitem.html#compare">QIconViewItem::compare</a>(), <a href="#setSorting">QIconView::setSorting</a>(), and <a href="#sortDirection-prop">QIconView::sortDirection</a>.
|
---|
869 |
|
---|
870 | <h3 class=fn>bool <a name="sortDirection"></a>QIconView::sortDirection () const
|
---|
871 | </h3><p>Returns TRUE if the sort direction for inserting new items is ascending;; otherwise returns FALSE.
|
---|
872 | See the <a href="qiconview.html#sortDirection-prop">"sortDirection"</a> property for details.
|
---|
873 | <h3 class=fn>bool <a name="sorting"></a>QIconView::sorting () const
|
---|
874 | </h3><p>Returns TRUE if the icon view sorts on insertion; otherwise returns FALSE.
|
---|
875 | See the <a href="qiconview.html#sorting-prop">"sorting"</a> property for details.
|
---|
876 | <h3 class=fn>int <a name="spacing"></a>QIconView::spacing () const
|
---|
877 | </h3><p>Returns the space in pixels between icon view items.
|
---|
878 | See the <a href="qiconview.html#spacing-prop">"spacing"</a> property for details.
|
---|
879 | <h3 class=fn>void <a name="startDrag"></a>QIconView::startDrag ()<tt> [virtual protected]</tt>
|
---|
880 | </h3>
|
---|
881 | Starts a drag.
|
---|
882 |
|
---|
883 | <h3 class=fn>void <a name="takeItem"></a>QIconView::takeItem ( <a href="qiconviewitem.html">QIconViewItem</a> * item )<tt> [virtual]</tt>
|
---|
884 | </h3>
|
---|
885 | Takes the icon view item <em>item</em> out of the icon view and causes
|
---|
886 | an update of the screen display. The item is not deleted. You
|
---|
887 | should normally not need to call this function because
|
---|
888 | <a href="qiconviewitem.html#~QIconViewItem">QIconViewItem::~QIconViewItem</a>() calls it. The normal way to delete
|
---|
889 | an item is to delete it.
|
---|
890 |
|
---|
891 | <h3 class=fn>bool <a name="wordWrapIconText"></a>QIconView::wordWrapIconText () const
|
---|
892 | </h3><p>Returns TRUE if the item text will be word-wrapped if it is too long; otherwise returns FALSE.
|
---|
893 | See the <a href="qiconview.html#wordWrapIconText-prop">"wordWrapIconText"</a> property for details.
|
---|
894 | <hr><h2>Property Documentation</h2>
|
---|
895 | <h3 class=fn><a href="qiconview.html#Arrangement-enum">Arrangement</a> <a name="arrangement-prop"></a>arrangement</h3>
|
---|
896 | <p>This property holds the arrangement mode of the icon view.
|
---|
897 | <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>.
|
---|
898 |
|
---|
899 | <p>Set this property's value with <a href="#setArrangement">setArrangement</a>() and get this property's value with <a href="#arrangement">arrangement</a>().
|
---|
900 | <h3 class=fn>bool <a name="autoArrange-prop"></a>autoArrange</h3>
|
---|
901 | <p>This property holds whether the icon view rearranges its items when a new item is inserted.
|
---|
902 | <p>The default is TRUE.
|
---|
903 | <p> Note that if the icon view is not visible at the time of
|
---|
904 | insertion, QIconView defers all position-related work until it is
|
---|
905 | shown and then calls <a href="#arrangeItemsInGrid">arrangeItemsInGrid</a>().
|
---|
906 |
|
---|
907 | <p>Set this property's value with <a href="#setAutoArrange">setAutoArrange</a>() and get this property's value with <a href="#autoArrange">autoArrange</a>().
|
---|
908 | <h3 class=fn>uint <a name="count-prop"></a>count</h3>
|
---|
909 | <p>This property holds the number of items in the icon view.
|
---|
910 | <p>
|
---|
911 | <p>Get this property's value with <a href="#count">count</a>().
|
---|
912 | <h3 class=fn>int <a name="gridX-prop"></a>gridX</h3>
|
---|
913 | <p>This property holds the horizontal grid of the icon view.
|
---|
914 | <p>If the value is -1, (the default), QIconView computes suitable
|
---|
915 | column widths based on the icon view's contents.
|
---|
916 | <p> Note that setting a grid width overrides <a href="#setMaxItemWidth">setMaxItemWidth</a>().
|
---|
917 |
|
---|
918 | <p>Set this property's value with <a href="#setGridX">setGridX</a>() and get this property's value with <a href="#gridX">gridX</a>().
|
---|
919 | <h3 class=fn>int <a name="gridY-prop"></a>gridY</h3>
|
---|
920 | <p>This property holds the vertical grid of the icon view.
|
---|
921 | <p>If the value is -1, (the default), QIconView computes suitable
|
---|
922 | column heights based on the icon view's contents.
|
---|
923 |
|
---|
924 | <p>Set this property's value with <a href="#setGridY">setGridY</a>() and get this property's value with <a href="#gridY">gridY</a>().
|
---|
925 | <h3 class=fn><a href="qbrush.html">QBrush</a> <a name="itemTextBackground-prop"></a>itemTextBackground</h3>
|
---|
926 | <p>This property holds the brush to use when drawing the background of an item's text.
|
---|
927 | <p>By default this brush is set to NoBrush, meaning that only the
|
---|
928 | normal icon view background is used.
|
---|
929 |
|
---|
930 | <p>Set this property's value with <a href="#setItemTextBackground">setItemTextBackground</a>() and get this property's value with <a href="#itemTextBackground">itemTextBackground</a>().
|
---|
931 | <h3 class=fn><a href="qiconview.html#ItemTextPos-enum">ItemTextPos</a> <a name="itemTextPos-prop"></a>itemTextPos</h3>
|
---|
932 | <p>This property holds the position where the text of each item is drawn.
|
---|
933 | <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>.
|
---|
934 |
|
---|
935 | <p>Set this property's value with <a href="#setItemTextPos">setItemTextPos</a>() and get this property's value with <a href="#itemTextPos">itemTextPos</a>().
|
---|
936 | <h3 class=fn>bool <a name="itemsMovable-prop"></a>itemsMovable</h3>
|
---|
937 | <p>This property holds whether the user is allowed to move items around in the icon view.
|
---|
938 | <p>The default is TRUE.
|
---|
939 |
|
---|
940 | <p>Set this property's value with <a href="#setItemsMovable">setItemsMovable</a>() and get this property's value with <a href="#itemsMovable">itemsMovable</a>().
|
---|
941 | <h3 class=fn>int <a name="maxItemTextLength-prop"></a>maxItemTextLength</h3>
|
---|
942 | <p>This property holds the maximum length (in characters) that an item's text may have.
|
---|
943 | <p>The default is 255 characters.
|
---|
944 |
|
---|
945 | <p>Set this property's value with <a href="#setMaxItemTextLength">setMaxItemTextLength</a>() and get this property's value with <a href="#maxItemTextLength">maxItemTextLength</a>().
|
---|
946 | <h3 class=fn>int <a name="maxItemWidth-prop"></a>maxItemWidth</h3>
|
---|
947 | <p>This property holds the maximum width that an item may have.
|
---|
948 | <p>The default is 100 pixels.
|
---|
949 | <p> Note that if the <a href="#gridX">gridX</a>() value is set QIconView will ignore
|
---|
950 | this property.
|
---|
951 |
|
---|
952 | <p>Set this property's value with <a href="#setMaxItemWidth">setMaxItemWidth</a>() and get this property's value with <a href="#maxItemWidth">maxItemWidth</a>().
|
---|
953 | <h3 class=fn><a href="qiconview.html#ResizeMode-enum">ResizeMode</a> <a name="resizeMode-prop"></a>resizeMode</h3>
|
---|
954 | <p>This property holds the resize mode of the icon view.
|
---|
955 | <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>.
|
---|
956 | See <a href="#ResizeMode-enum">ResizeMode</a>.
|
---|
957 |
|
---|
958 | <p>Set this property's value with <a href="#setResizeMode">setResizeMode</a>() and get this property's value with <a href="#resizeMode">resizeMode</a>().
|
---|
959 | <h3 class=fn><a href="qiconview.html#SelectionMode-enum">SelectionMode</a> <a name="selectionMode-prop"></a>selectionMode</h3>
|
---|
960 | <p>This property holds the selection mode of the icon view.
|
---|
961 | <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>.
|
---|
962 |
|
---|
963 | <p>Set this property's value with <a href="#setSelectionMode">setSelectionMode</a>() and get this property's value with <a href="#selectionMode">selectionMode</a>().
|
---|
964 | <h3 class=fn>bool <a name="showToolTips-prop"></a>showToolTips</h3>
|
---|
965 | <p>This property holds whether the icon view will display a tool tip with the complete text for any truncated item text.
|
---|
966 | <p>The default is TRUE. Note that this has no effect if
|
---|
967 | <a href="#setWordWrapIconText">setWordWrapIconText</a>() is TRUE, as it is by default.
|
---|
968 |
|
---|
969 | <p>Set this property's value with <a href="#setShowToolTips">setShowToolTips</a>() and get this property's value with <a href="#showToolTips">showToolTips</a>().
|
---|
970 | <h3 class=fn>bool <a name="sortDirection-prop"></a>sortDirection</h3>
|
---|
971 | <p>This property holds whether the sort direction for inserting new items is ascending;.
|
---|
972 | <p>The default is TRUE (i.e. ascending). This sort direction is only
|
---|
973 | meaningful if both <a href="#sorting">sorting</a>() and <a href="#autoArrange">autoArrange</a>() are TRUE.
|
---|
974 | <p> To set the sort direction, use <a href="#setSorting">setSorting</a>()
|
---|
975 |
|
---|
976 | <p>Get this property's value with <a href="#sortDirection">sortDirection</a>().
|
---|
977 | <h3 class=fn>bool <a name="sorting-prop"></a>sorting</h3>
|
---|
978 | <p>This property holds whether the icon view sorts on insertion.
|
---|
979 | <p>The default is FALSE, i.e. no sorting on insertion.
|
---|
980 | <p> To set the sorting, use <a href="#setSorting">setSorting</a>().
|
---|
981 |
|
---|
982 | <p>Get this property's value with <a href="#sorting">sorting</a>().
|
---|
983 | <h3 class=fn>int <a name="spacing-prop"></a>spacing</h3>
|
---|
984 | <p>This property holds the space in pixels between icon view items.
|
---|
985 | <p>The default is 5 pixels.
|
---|
986 | <p> Negative values for spacing are illegal.
|
---|
987 |
|
---|
988 | <p>Set this property's value with <a href="#setSpacing">setSpacing</a>() and get this property's value with <a href="#spacing">spacing</a>().
|
---|
989 | <h3 class=fn>bool <a name="wordWrapIconText-prop"></a>wordWrapIconText</h3>
|
---|
990 | <p>This property holds whether the item text will be word-wrapped if it is too long.
|
---|
991 | <p>The default is TRUE.
|
---|
992 | <p> If this property is FALSE, icon text that is too long is
|
---|
993 | truncated, and an ellipsis (...) appended to indicate that
|
---|
994 | truncation has occurred. The full text can still be seen by the
|
---|
995 | user if they hover the mouse because the full text is shown in a
|
---|
996 | tooltip; see <a href="#setShowToolTips">setShowToolTips</a>().
|
---|
997 |
|
---|
998 | <p>Set this property's value with <a href="#setWordWrapIconText">setWordWrapIconText</a>() and get this property's value with <a href="#wordWrapIconText">wordWrapIconText</a>().
|
---|
999 | <!-- eof -->
|
---|
1000 | <hr><p>
|
---|
1001 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
1002 | Copyright © 1995-2007
|
---|
1003 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
1004 | <table width=100% cellspacing=0 border=0><tr>
|
---|
1005 | <td>Copyright © 2007
|
---|
1006 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
1007 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
1008 | </table></div></address></body>
|
---|
1009 | </html>
|
---|