1QListViewItem(3qt)                                          QListViewItem(3qt)
2
3
4

NAME

6       QListViewItem - Implements a list view item
7

SYNOPSIS

9       #include <qlistview.h>
10
11       Inherits Qt.
12
13       Inherited by QCheckListItem.
14
15   Public Members
16       QListViewItem ( QListView * parent )
17       QListViewItem ( QListViewItem * parent )
18       QListViewItem ( QListView * parent, QListViewItem * after )
19       QListViewItem ( QListViewItem * parent, QListViewItem * after )
20       QListViewItem ( QListView * parent, QString label1, QString label2 =
21           QString::null, QString label3 = QString::null, QString label4 =
22           QString::null, QString label5 = QString::null, QString label6 =
23           QString::null, QString label7 = QString::null, QString label8 =
24           QString::null )
25       QListViewItem ( QListViewItem * parent, QString label1, QString label2
26           = QString::null, QString label3 = QString::null, QString label4 =
27           QString::null, QString label5 = QString::null, QString label6 =
28           QString::null, QString label7 = QString::null, QString label8 =
29           QString::null )
30       QListViewItem ( QListView * parent, QListViewItem * after, QString
31           label1, QString label2 = QString::null, QString label3 =
32           QString::null, QString label4 = QString::null, QString label5 =
33           QString::null, QString label6 = QString::null, QString label7 =
34           QString::null, QString label8 = QString::null )
35       QListViewItem ( QListViewItem * parent, QListViewItem * after, QString
36           label1, QString label2 = QString::null, QString label3 =
37           QString::null, QString label4 = QString::null, QString label5 =
38           QString::null, QString label6 = QString::null, QString label7 =
39           QString::null, QString label8 = QString::null )
40       virtual ~QListViewItem ()
41       virtual void insertItem ( QListViewItem * newChild )
42       virtual void takeItem ( QListViewItem * item )
43       virtual void removeItem ( QListViewItem * item )  (obsolete)
44       int height () const
45       virtual void invalidateHeight ()
46       int totalHeight () const
47       virtual int width ( const QFontMetrics & fm, const QListView * lv, int
48           c ) const
49       void widthChanged ( int c = -1 ) const
50       int depth () const
51       virtual void setText ( int column, const QString & text )
52       virtual QString text ( int column ) const
53       virtual void setPixmap ( int column, const QPixmap & pm )
54       virtual const QPixmap * pixmap ( int column ) const
55       virtual QString key ( int column, bool ascending ) const
56       virtual int compare ( QListViewItem * i, int col, bool ascending )
57           const
58       virtual void sortChildItems ( int column, bool ascending )
59       int childCount () const
60       bool isOpen () const
61       virtual void setOpen ( bool o )
62       virtual void setup ()
63       virtual void setSelected ( bool s )
64       bool isSelected () const
65       virtual void paintCell ( QPainter * p, const QColorGroup & cg, int
66           column, int width, int align )
67       virtual void paintBranches ( QPainter * p, const QColorGroup & cg, int
68           w, int y, int h )
69       virtual void paintFocus ( QPainter * p, const QColorGroup & cg, const
70           QRect & r )
71       QListViewItem * firstChild () const
72       QListViewItem * nextSibling () const
73       QListViewItem * parent () const
74       QListViewItem * itemAbove ()
75       QListViewItem * itemBelow ()
76       int itemPos () const
77       QListView * listView () const
78       virtual void setSelectable ( bool enable )
79       bool isSelectable () const
80       virtual void setExpandable ( bool enable )
81       bool isExpandable () const
82       void repaint () const
83       virtual void sort ()
84       void moveItem ( QListViewItem * after )
85       virtual void setDragEnabled ( bool allow )
86       virtual void setDropEnabled ( bool allow )
87       bool dragEnabled () const
88       bool dropEnabled () const
89       virtual bool acceptDrop ( const QMimeSource * mime ) const
90       void setVisible ( bool b )
91       bool isVisible () const
92       virtual void setRenameEnabled ( int col, bool b )
93       bool renameEnabled ( int col ) const
94       virtual void startRename ( int col )
95       virtual void setEnabled ( bool b )
96       bool isEnabled () const
97       virtual int rtti () const
98       virtual void setMultiLinesEnabled ( bool b )
99       bool multiLinesEnabled () const
100
101   Protected Members
102       virtual void enforceSortOrder () const
103       virtual void setHeight ( int height )
104       virtual void activate ()
105       bool activatedPos ( QPoint & pos )
106       virtual void dropped ( QDropEvent * e )
107       virtual void dragEntered ()
108       virtual void dragLeft ()
109       virtual void okRename ( int col )
110       virtual void cancelRename ( int col )
111

DESCRIPTION

113       The QListViewItem class implements a list view item.
114
115       A list view item is a multi-column object capable of displaying itself
116       in a QListView.
117
118       The easiest way to use QListViewItem is to construct one with a few
119       constant strings, and either a QListView or another QListViewItem as
120       parent.
121
122               (void) new QListViewItem( listView, "Column 1", "Column 2" );
123               (void) new QListViewItem( listView->firstChild(), "A", "B", "C" );
124       We've discarded the pointers to the items since we can still access
125       them via their parent listView. By default, QListView sorts its items;
126       this can be switched off with QListView::setSorting(-1).
127
128       The parent must be another QListViewItem or a QListView. If the parent
129       is a QListView, the item becomes a top-level item within that
130       QListView. If the parent is another QListViewItem, the item becomes a
131       child of that list view item.
132
133       If you keep the pointer, you can set or change the texts using
134       setText(), add pixmaps using setPixmap(), change its mode using
135       setSelectable(), setSelected(), setOpen() and setExpandable(). You'll
136       also be able to change its height using setHeight(), and traverse its
137       sub-items. You don't have to keep the pointer since you can get a
138       pointer to any QListViewItem in a QListView using
139       QListView::selectedItem(), QListView::currentItem(),
140       QListView::firstChild(), QListView::lastItem() and
141       QListView::findItem().
142
143       If you call delete on a list view item, it will be deleted as expected,
144       and as usual for QObjects, if it has any child items (to any depth),
145       all these will be deleted too.
146
147       QCheckListItems are list view items that have a checkbox or radio
148       button and can be used in place of plain QListViewItems.
149
150       You can traverse the tree as if it were a doubly-linked list using
151       itemAbove() and itemBelow(); they return pointers to the items directly
152       above and below this item on the screen (even if none of them are
153       actually visible at the moment).
154
155       Here's how to traverse all of an item's children (but not its
156       children's children, etc.): Example:
157
158               QListViewItem * myChild = myItem->firstChild();
159               while( myChild ) {
160                   doSomething( myChild );
161                   myChild = myChild->nextSibling();
162               }
163
164       If you want to iterate over every item, to any level of depth use an
165       iterator. To iterate over the entire tree, initialize the iterator with
166       the list view itself; to iterate starting from a particular item,
167       initialize the iterator with the item:
168
169               QListViewItemIterator it( listview );
170               while ( it.current() ) {
171                   QListViewItem *item = it.current();
172                   doSomething( item );
173                   ++it;
174               }
175
176       Note that the order of the children will change when the sorting order
177       changes and is undefined if the items are not visible. You can,
178       however, call enforceSortOrder() at any time; QListView will always
179       call it before it needs to show an item.
180
181       Many programs will need to reimplement QListViewItem. The most commonly
182       reimplemented functions are: <center>.nf
183
184       </center>
185
186       Some subclasses call setExpandable(TRUE) even when they have no
187       children, and populate themselves when setup() or setOpen(TRUE) is
188       called. The dirview/dirview.cpp example program uses this technique to
189       start up quickly: The files and subdirectories in a directory aren't
190       inserted into the tree until they're actually needed.
191
192       <center>
193                                   [Image Omitted]
194
195       </center>
196
197       See also QCheckListItem, QListView, and Advanced Widgets.
198

MEMBER FUNCTION DOCUMENTATION

QListViewItem::QListViewItem ( QListView * parent )

201       Constructs a new top-level list view item in the QListView parent.
202

QListViewItem::QListViewItem ( QListViewItem * parent )

204       Constructs a new list view item that is a child of parent and first in
205       the parent's list of children.
206

QListViewItem::QListViewItem ( QListView * parent, QListViewItem * after )

208       Constructs an empty list view item that is a child of parent and is
209       after item after in the parent's list of children. Since parent is a
210       QListView the item will be a top-level item.
211

QListViewItem::QListViewItem ( QListViewItem * parent, QListViewItem * after )

213
214       Constructs an empty list view item that is a child of parent and is
215       after item after in the parent's list of children.
216

QListViewItem::QListViewItem ( QListView * parent, QString label1, QString

218       label2 = QString::null, QString label3 = QString::null, QString label4
219       = QString::null, QString label5 = QString::null, QString label6 =
220       QString::null, QString label7 = QString::null, QString label8 =
221       QString::null )
222       Constructs a new top-level list view item in the QListView parent, with
223       up to eight constant strings, label1, label2, label3, label4, label5,
224       label6, label7 and label8 defining its columns' contents.
225
226       See also setText().
227

QListViewItem::QListViewItem ( QListViewItem * parent, QString label1, QString

229       label2 = QString::null, QString label3 = QString::null, QString label4
230       = QString::null, QString label5 = QString::null, QString label6 =
231       QString::null, QString label7 = QString::null, QString label8 =
232       QString::null )
233       Constructs a new list view item as a child of the QListViewItem parent
234       with up to eight constant strings, label1, label2, label3, label4,
235       label5, label6, label7 and label8 as columns' contents.
236
237       See also setText().
238

QListViewItem::QListViewItem ( QListView * parent, QListViewItem * after,

240       QString label1, QString label2 = QString::null, QString label3 =
241       QString::null, QString label4 = QString::null, QString label5 =
242       QString::null, QString label6 = QString::null, QString label7 =
243       QString::null, QString label8 = QString::null )
244       Constructs a new list view item in the QListView parent that is
245       included after item after and that has up to eight column texts,
246       label1, label2, label3, label4, label5, label6, label7 andlabel8.
247
248       Note that the order is changed according to QListViewItem::key() unless
249       the list view's sorting is disabled using QListView::setSorting(-1).
250
251       See also setText().
252

QListViewItem::QListViewItem ( QListViewItem * parent, QListViewItem * after,

254       QString label1, QString label2 = QString::null, QString label3 =
255       QString::null, QString label4 = QString::null, QString label5 =
256       QString::null, QString label6 = QString::null, QString label7 =
257       QString::null, QString label8 = QString::null )
258       Constructs a new list view item as a child of the QListViewItem parent.
259       It is inserted after item after and may contain up to eight strings,
260       label1, label2, label3, label4, label5, label6, label7 and label8 as
261       column entries.
262
263       Note that the order is changed according to QListViewItem::key() unless
264       the list view's sorting is disabled using QListView::setSorting(-1).
265
266       See also setText().
267

QListViewItem::~QListViewItem () [virtual]

269       Destroys the item, deleting all its children and freeing up all
270       allocated resources.
271

bool QListViewItem::acceptDrop ( const QMimeSource * mime ) const [virtual]

273       Returns TRUE if the item can accept drops of type QMimeSource mime;
274       otherwise returns FALSE.
275
276       The default implementation does nothing and returns FALSE. A subclass
277       must reimplement this to accept drops.
278

void QListViewItem::activate () [virtual protected]

280       This virtual function is called whenever the user presses the mouse on
281       this item or presses Space on it.
282
283       See also activatedPos().
284
285       Reimplemented in QCheckListItem.
286

bool QListViewItem::activatedPos ( QPoint & pos ) [protected]

288       When called from a reimplementation of activate(), this function gives
289       information on how the item was activated. Otherwise the behavior is
290       undefined.
291
292       If activate() was caused by a mouse press, the function sets pos to
293       where the user clicked and returns TRUE; otherwise it returns FALSE and
294       does not change pos.
295
296       pos is relative to the top-left corner of this item.
297
298       Warning: We recommend that you ignore this function; it is scheduled to
299       become obsolete.
300
301       See also activate().
302

void QListViewItem::cancelRename ( int col ) [virtual protected]

304       This function is called if the user cancels in-place renaming of this
305       item in column col (e.g. by pressing Esc).
306
307       See also okRename().
308

int QListViewItem::childCount () const

310       Returns how many children this item has. The count only includes the
311       item's immediate children.
312

int QListViewItem::compare ( QListViewItem * i, int col, bool ascending )

314       const [virtual]
315       Compares this list view item to i using the column col in ascending
316       order. Returns < 0 if this item is less than i, 0 if they are equal and
317       > 0 if this item is greater than i.
318
319       This function is used for sorting.
320
321       The default implementation compares the item keys (key()) using
322       QString::localeAwareCompare(). A reimplementation can use different
323       values and a different comparison function. Here is a reimplementation
324       that uses plain Unicode comparison:
325
326           int MyListViewItem::compare( QListViewItem *i, int col,
327                                        bool ascending ) const
328           {
329               return key( col, ascending ).compare( i->key( col, ascending) );
330           }
331       We don't recommend using ascending so your code can safely ignore it.
332
333       See also key(), QString::localeAwareCompare(), and QString::compare().
334

int QListViewItem::depth () const

336       Returns the depth of this item.
337
338       Example: dirview/dirview.cpp.
339

bool QListViewItem::dragEnabled () const

341       Returns TRUE if this item can be dragged; otherwise returns FALSE.
342
343       See also setDragEnabled().
344

void QListViewItem::dragEntered () [virtual protected]

346       This function is called when a drag enters the item's bounding
347       rectangle.
348
349       The default implementation does nothing, subclasses may need to
350       reimplement this function.
351

void QListViewItem::dragLeft () [virtual protected]

353       This function is called when a drag leaves the item's bounding
354       rectangle.
355
356       The default implementation does nothing, subclasses may need to
357       reimplement this function.
358

bool QListViewItem::dropEnabled () const

360       Returns TRUE if this item accepts drops; otherwise returns FALSE.
361
362       See also setDropEnabled() and acceptDrop().
363

void QListViewItem::dropped ( QDropEvent * e ) [virtual protected]

365       This function is called when something was dropped on the item. e
366       contains all the information about the drop.
367
368       The default implementation does nothing, subclasses may need to
369       reimplement this function.
370

void QListViewItem::enforceSortOrder () const [virtual protected]

372       Makes sure that this object's children are sorted appropriately.
373
374       This only works if every item from the root item down to this item is
375       already sorted.
376
377       See also sortChildItems().
378

QListViewItem * QListViewItem::firstChild () const

380       Returns the first (top) child of this item, or 0 if this item has no
381       children.
382
383       Note that the children are not guaranteed to be sorted properly.
384       QListView and QListViewItem try to postpone or avoid sorting to the
385       greatest degree possible, in order to keep the user interface snappy.
386
387       See also nextSibling() and sortChildItems().
388
389       Example: checklists/checklists.cpp.
390

int QListViewItem::height () const

392       Returns the height of this item in pixels. This does not include the
393       height of any children; totalHeight() returns that.
394

void QListViewItem::insertItem ( QListViewItem * newChild ) [virtual]

396       Inserts newChild into this list view item's list of children. You
397       should not need to call this function; it is called automatically by
398       the constructor of newChild.
399
400       Warning: If you are using Single selection mode, then you should only
401       insert unselected items.
402

void QListViewItem::invalidateHeight () [virtual]

404       Invalidates the cached total height of this item, including all open
405       children.
406
407       See also setHeight(), height(), and totalHeight().
408

bool QListViewItem::isEnabled () const

410       Returns TRUE if this item is enabled; otherwise returns FALSE.
411
412       See also setEnabled().
413

bool QListViewItem::isExpandable () const

415       Returns TRUE if this item is expandable even when it has no children;
416       otherwise returns FALSE.
417

bool QListViewItem::isOpen () const

419       Returns TRUE if this list view item has children and they are not
420       explicitly hidden; otherwise returns FALSE.
421
422       See also setOpen().
423

bool QListViewItem::isSelectable () const

425       Returns TRUE if the item is selectable (as it is by default); otherwise
426       returns FALSE
427
428       See also setSelectable().
429

bool QListViewItem::isSelected () const

431       Returns TRUE if this item is selected; otherwise returns FALSE.
432
433       See also setSelected(), QListView::setSelected(), and
434       QListView::selectionChanged().
435
436       Example: listviews/listviews.cpp.
437

bool QListViewItem::isVisible () const

439       Returns TRUE if the item is visible; otherwise returns FALSE.
440
441       See also setVisible().
442

QListViewItem * QListViewItem::itemAbove ()

444       Returns a pointer to the item immediately above this item on the
445       screen. This is usually the item's closest older sibling, but it may
446       also be its parent or its next older sibling's youngest child, or
447       something else if anyoftheabove->height() returns 0. Returns 0 if there
448       is no item immediately above this item.
449
450       This function assumes that all parents of this item are open (i.e. that
451       this item is visible, or can be made visible by scrolling).
452
453       This function might be relatively slow because of the tree traversions
454       needed to find the correct item.
455
456       See also itemBelow() and QListView::itemRect().
457

QListViewItem * QListViewItem::itemBelow ()

459       Returns a pointer to the item immediately below this item on the
460       screen. This is usually the item's eldest child, but it may also be its
461       next younger sibling, its parent's next younger sibling, grandparent's,
462       etc., or something else if anyoftheabove->height() returns 0. Returns 0
463       if there is no item immediately below this item.
464
465       This function assumes that all parents of this item are open (i.e. that
466       this item is visible or can be made visible by scrolling).
467
468       See also itemAbove() and QListView::itemRect().
469
470       Example: dirview/dirview.cpp.
471

int QListViewItem::itemPos () const

473       Returns the y coordinate of this item in the list view's coordinate
474       system. This function is normally much slower than QListView::itemAt(),
475       but it works for all items whereas QListView::itemAt() normally only
476       works for items on the screen.
477
478       See also QListView::itemAt(), QListView::itemRect(), and
479       QListView::itemPos().
480

QString QListViewItem::key ( int column, bool ascending ) const [virtual]

482       Returns a key that can be used for sorting by column column. The
483       default implementation returns text(). Derived classes may also
484       incorporate the order indicated by ascending into this key, although
485       this is not recommended.
486
487       If you want to sort on non-alphabetical data, e.g. dates, numbers,
488       etc., it is more efficient to reimplement compare().
489
490       See also compare() and sortChildItems().
491

QListView * QListViewItem::listView () const

493       Returns a pointer to the list view containing this item.
494
495       Note that this function traverses the items to the root to find the
496       listview. This function will return 0 for taken items - see
497       QListViewItem::takeItem()
498

void QListViewItem::moveItem ( QListViewItem * after )

500       Move the item to be after item after, which must be one of the item's
501       siblings. To move an item in the hierarchy, use takeItem() and
502       insertItem().
503
504       Note that this function will have no effect if sorting is enabled in
505       the list view.
506

bool QListViewItem::multiLinesEnabled () const

508       Returns TRUE if the item can display multiple lines of text in its
509       columns; otherwise returns FALSE.
510

QListViewItem * QListViewItem::nextSibling () const

512       Returns the sibling item below this item, or 0 if there is no sibling
513       item after this item.
514
515       Note that the siblings are not guaranteed to be sorted properly.
516       QListView and QListViewItem try to postpone or avoid sorting to the
517       greatest degree possible, in order to keep the user interface snappy.
518
519       See also firstChild() and sortChildItems().
520
521       Example: xml/tagreader-with-features/structureparser.cpp.
522

void QListViewItem::okRename ( int col ) [virtual protected]

524       This function is called if the user presses Enter during in-place
525       renaming of the item in column col.
526
527       See also cancelRename().
528

void QListViewItem::paintBranches ( QPainter * p, const QColorGroup & cg, int

530       w, int y, int h ) [virtual]
531       Paints a set of branches from this item to (some of) its children.
532
533       Painter p is set up with clipping and translation so that you can only
534       draw in the rectangle that needs redrawing; cg is the color group to
535       use; the update rectangle is at (0, 0) and has size width w by height
536       h. The top of the rectangle you own is at y (which is never greater
537       than 0 but can be outside the window system's allowed coordinate
538       range).
539
540       The update rectangle is in an undefined state when this function is
541       called; this function must draw on all of the pixels.
542
543       See also paintCell() and QListView::drawContentsOffset().
544

void QListViewItem::paintCell ( QPainter * p, const QColorGroup & cg, int

546       column, int width, int align ) [virtual]
547       This virtual function paints the contents of one column of an item and
548       aligns it as described by align.
549
550       p is a QPainter open on the relevant paint device. p is translated so
551       (0, 0) is the top-left pixel in the cell and width-1, height()-1 is the
552       bottom-right pixel in the cell. The other properties of p (pen, brush,
553       etc) are undefined. cg is the color group to use. column is the logical
554       column number within the item that is to be painted; 0 is the column
555       which may contain a tree.
556
557       This function may use QListView::itemMargin() for readability spacing
558       on the left and right sides of data such as text, and should honor
559       isSelected() and QListView::allColumnsShowFocus().
560
561       If you reimplement this function, you should also reimplement width().
562
563       The rectangle to be painted is in an undefined state when this function
564       is called, so you must draw on all the pixels. The painter p has the
565       right font on entry.
566
567       See also paintBranches() and QListView::drawContentsOffset().
568
569       Example: listviews/listviews.cpp.
570
571       Reimplemented in QCheckListItem.
572

void QListViewItem::paintFocus ( QPainter * p, const QColorGroup & cg, const

574       QRect & r ) [virtual]
575       Paints a focus indicator on the rectangle r using painter p and colors
576       cg.
577
578       p is already clipped.
579
580       See also paintCell(), paintBranches(), and
581       QListView::allColumnsShowFocus.
582
583       Reimplemented in QCheckListItem.
584

QListViewItem * QListViewItem::parent () const

586       Returns the parent of this item, or 0 if this item has no parent.
587
588       See also firstChild() and nextSibling().
589
590       Examples:
591

const QPixmap * QListViewItem::pixmap ( int column ) const [virtual]

593       Returns the pixmap for column, or 0 if there is no pixmap for column.
594
595       See also setText() and setPixmap().
596
597       Example: dirview/dirview.cpp.
598

void QListViewItem::removeItem ( QListViewItem * item ) [virtual]

600       This function is obsolete. It is provided to keep old source working.
601       We strongly advise against using it in new code.
602
603       This function has been renamed takeItem().
604

bool QListViewItem::renameEnabled ( int col ) const

606       Returns TRUE if this item can be in-place renamed in column col;
607       otherwise returns FALSE.
608

void QListViewItem::repaint () const

610       Repaints this item on the screen if it is currently visible.
611
612       Example: addressbook/centralwidget.cpp.
613

int QListViewItem::rtti () const [virtual]

615       Returns 0.
616
617       Make your derived classes return their own values for rtti(), so that
618       you can distinguish between different kinds of list view items. You
619       should use values greater than 1000 to allow for extensions to this
620       class.
621
622       Reimplemented in QCheckListItem.
623

void QListViewItem::setDragEnabled ( bool allow ) [virtual]

625       If allow is TRUE, the list view starts a drag (see
626       QListView::dragObject()) when the user presses and moves the mouse on
627       this item.
628

void QListViewItem::setDropEnabled ( bool allow ) [virtual]

630       If allow is TRUE, the list view accepts drops onto the item; otherwise
631       drops are not allowed.
632

void QListViewItem::setEnabled ( bool b ) [virtual]

634       If b is TRUE the item is enabled; otherwise it is disabled. Disabled
635       items are drawn differently (e.g. grayed-out) and are not accessible by
636       the user.
637

void QListViewItem::setExpandable ( bool enable ) [virtual]

639       Sets this item to be expandable even if it has no children if enable is
640       TRUE, and to be expandable only if it has children if enable is FALSE
641       (the default).
642
643       The dirview example uses this in the canonical fashion. It checks
644       whether the directory is empty in setup() and calls setExpandable(TRUE)
645       if not; in setOpen() it reads the contents of the directory and inserts
646       items accordingly. This strategy means that dirview can display the
647       entire file system without reading very much at startup.
648
649       Note that root items are not expandable by the user unless
650       QListView::setRootIsDecorated() is set to TRUE.
651
652       See also setSelectable().
653

void QListViewItem::setHeight ( int height ) [virtual protected]

655       Sets this item's height to height pixels. This implicitly changes
656       totalHeight(), too.
657
658       Note that a font change causes this height to be overwritten unless you
659       reimplement setup().
660
661       For best results in Windows style we suggest using an even number of
662       pixels.
663
664       See also height(), totalHeight(), and isOpen().
665

void QListViewItem::setMultiLinesEnabled ( bool b ) [virtual]

667       If b is TRUE each of the item's columns may contain multiple lines of
668       text; otherwise each of them may only contain a single line.
669

void QListViewItem::setOpen ( bool o ) [virtual]

671       Opens or closes an item, i.e. shows or hides an item's children.
672
673       If o is TRUE all child items are shown initially. The user can hide
674       them by clicking the - icon to the left of the item. If o is FALSE, the
675       children of this item are initially hidden. The user can show them by
676       clicking the + icon to the left of the item.
677
678       See also height(), totalHeight(), and isOpen().
679
680       Examples:
681

void QListViewItem::setPixmap ( int column, const QPixmap & pm ) [virtual]

683       Sets the pixmap in column column to pm, if pm is non-null and different
684       from the current pixmap, and if column is non-negative.
685
686       See also pixmap() and setText().
687
688       Example: dirview/dirview.cpp.
689

void QListViewItem::setRenameEnabled ( int col, bool b ) [virtual]

691       If b is TRUE, this item can be in-place renamed in the column col by
692       the user; otherwise it cannot be renamed in-place.
693

void QListViewItem::setSelectable ( bool enable ) [virtual]

695       Sets this item to be selectable if enable is TRUE (the default) or not
696       to be selectable if enable is FALSE.
697
698       The user is not able to select a non-selectable item using either the
699       keyboard or the mouse. This also applies for the application programmer
700       (e.g. setSelected() respects this value).
701
702       See also isSelectable().
703

void QListViewItem::setSelected ( bool s ) [virtual]

705       If s is TRUE this item is selected; otherwise it is deselected.
706
707       This function does not maintain any invariants or repaint anything --
708       QListView::setSelected() does that.
709
710       See also height() and totalHeight().
711
712       Example: addressbook/centralwidget.cpp.
713

void QListViewItem::setText ( int column, const QString & text ) [virtual]

715       Sets the text in column column to text, if column is a valid column
716       number and text is different from the existing text.
717
718       If text() has been reimplemented, this function may be a no-op.
719
720       See also text() and key().
721
722       Examples:
723

void QListViewItem::setVisible ( bool b )

725       If b is TRUE, the item is made visible; otherwise it is hidden.
726
727       If the item is not visible, itemAbove() and itemBelow() will never
728       return this item, although you still can reach it by using e.g.
729       QListViewItemIterator.
730

void QListViewItem::setup () [virtual]

732       This virtual function is called before the first time QListView needs
733       to know the height or any other graphical attribute of this object, and
734       whenever the font, GUI style, or colors of the list view change.
735
736       The default calls widthChanged() and sets the item's height to the
737       height of a single line of text in the list view's font. (If you use
738       icons, multi-line text, etc., you will probably need to call
739       setHeight() yourself or reimplement it.)
740
741       Example: dirview/dirview.cpp.
742

void QListViewItem::sort () [virtual]

744       Sorts all this item's child items using the current sorting
745       configuration (sort column and direction).
746
747       See also enforceSortOrder().
748

void QListViewItem::sortChildItems ( int column, bool ascending ) [virtual]

750       Sorts this item's children using column column. This is done in
751       ascending order if ascending is TRUE and in descending order if
752       ascending is FALSE.
753
754       Asks some of the children to sort their children. (QListView and
755       QListViewItem ensure that all on-screen objects are properly sorted but
756       may avoid or defer sorting other objects in order to be more
757       responsive.)
758
759       See also key() and compare().
760

void QListViewItem::startRename ( int col ) [virtual]

762       If in-place renaming of this item is enabled (see renameEnabled()),
763       this function starts renaming the item in column col, by creating and
764       initializing an edit box.
765

void QListViewItem::takeItem ( QListViewItem * item ) [virtual]

767       Removes item from this object's list of children and causes an update
768       of the screen display. The item is not deleted. You should not normally
769       need to call this function because QListViewItem::~QListViewItem()
770       calls it.
771
772       The normal way to delete an item is to use delete.
773
774       If you need to move an item from one place in the hierarchy to another
775       you can use takeItem() to remove the item from the list view and then
776       insertItem() to put the item back in its new position.
777
778       If a taken item is part of a selection in Single selection mode, it is
779       unselected and selectionChanged() is emitted. If a taken item is part
780       of a selection in Multi or Extended selection mode, it remains
781       selected.
782
783       Warning: This function leaves item and its children in a state where
784       most member functions are unsafe. Only a few functions work correctly
785       on an item in this state, most notably insertItem(). The functions that
786       work on taken items are explicitly documented as such.
787
788       See also QListViewItem::insertItem().
789

QString QListViewItem::text ( int column ) const [virtual]

791       Returns the text in column column, or QString::null if there is no text
792       in that column.
793
794       See also key() and paintCell().
795
796       Examples:
797

int QListViewItem::totalHeight () const

799       Returns the total height of this object, including any visible
800       children. This height is recomputed lazily and cached for as long as
801       possible.
802
803       Functions which can affect the total height are, setHeight() which is
804       used to set an item's height, setOpen() to show or hide an item's
805       children, and invalidateHeight() to invalidate the cached height.
806
807       See also height().
808

int QListViewItem::width ( const QFontMetrics & fm, const QListView * lv, int

810       c ) const [virtual]
811       Returns the number of pixels of width required to draw column c of list
812       view lv, using the metrics fm without cropping. The list view
813       containing this item may use this information depending on the
814       QListView::WidthMode settings for the column.
815
816       The default implementation returns the width of the bounding rectangle
817       of the text of column c.
818
819       See also listView(), widthChanged(), QListView::setColumnWidthMode(),
820       and QListView::itemMargin.
821

void QListViewItem::widthChanged ( int c = -1 ) const

823       Call this function when the value of width() may have changed for
824       column c. Normally, you should call this if text(c) changes. Passing -1
825       for c indicates that all columns may have changed. It is more efficient
826       to pass -1 if two or more columns have changed than to call
827       widthChanged() separately for each one.
828
829       See also width().
830
831

SEE ALSO

833       http://doc.trolltech.com/qlistviewitem.html
834       http://www.trolltech.com/faq/tech.html
835
837       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
838       license file included in the distribution for a complete license
839       statement.
840

AUTHOR

842       Generated automatically from the source code.
843

BUGS

845       If you find a bug in Qt, please report it as described in
846       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
847       help you. Thank you.
848
849       The definitive Qt documentation is provided in HTML format; it is
850       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
851       web browser. This man page is provided as a convenience for those users
852       who prefer man pages, although this format is not officially supported
853       by Trolltech.
854
855       If you find errors in this manual page, please report them to qt-
856       bugs@trolltech.com.  Please include the name of the manual page
857       (qlistviewitem.3qt) and the Qt version (3.3.8).
858
859
860
861Trolltech AS                    2 February 2007             QListViewItem(3qt)
Impressum