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