1QListViewItemIterator(3qt)                          QListViewItemIterator(3qt)
2
3
4

NAME

6       QListViewItemIterator - Iterator for collections of QListViewItems
7

SYNOPSIS

9       #include <qlistview.h>
10
11   Public Members
12       enum IteratorFlag { Visible = 0x00000001, Invisible = 0x00000002,
13           Selected = 0x00000004, Unselected = 0x00000008, Selectable =
14           0x00000010, NotSelectable = 0x00000020, DragEnabled = 0x00000040,
15           DragDisabled = 0x00000080, DropEnabled = 0x00000100, DropDisabled =
16           0x00000200, Expandable = 0x00000400, NotExpandable = 0x00000800,
17           Checked = 0x00001000, NotChecked = 0x00002000 }
18       QListViewItemIterator ()
19       QListViewItemIterator ( QListViewItem * item )
20       QListViewItemIterator ( QListViewItem * item, int iteratorFlags )
21       QListViewItemIterator ( const QListViewItemIterator & it )
22       QListViewItemIterator ( QListView * lv )
23       QListViewItemIterator ( QListView * lv, int iteratorFlags )
24       QListViewItemIterator & operator= ( const QListViewItemIterator & it )
25       ~QListViewItemIterator ()
26       QListViewItemIterator & operator++ ()
27       const QListViewItemIterator operator++ ( int )
28       QListViewItemIterator & operator+= ( int j )
29       QListViewItemIterator & operator-- ()
30       const QListViewItemIterator operator-- ( int )
31       QListViewItemIterator & operator-= ( int j )
32       QListViewItem * operator* ()
33       QListViewItem * current () const
34

DESCRIPTION

36       The QListViewItemIterator class provides an iterator for collections of
37       QListViewItems.
38
39       Construct an instance of a QListViewItemIterator, with either a
40       QListView* or a QListViewItem* as argument, to operate on the tree of
41       QListViewItems, starting from the argument.
42
43       A QListViewItemIterator iterates over all the items from its starting
44       point. This means that it always makes the first child of the current
45       item the new current item. If there is no child, the next sibling
46       becomes the new current item; and if there is no next sibling, the next
47       sibling of the parent becomes current.
48
49       The following example creates a list of all the items that have been
50       selected by the user, storing pointers to the items in a QPtrList:
51
52           QPtrList<QListViewItem> lst;
53           QListViewItemIterator it( myListView );
54           while ( it.current() ) {
55               if ( it.current()->isSelected() )
56                   lst.append( it.current() );
57               ++it;
58           }
59
60       An alternative approach is to use an IteratorFlag:
61
62           QPtrList<QListViewItem> lst;
63           QListViewItemIterator it( myListView, QListViewItemIterator::Selected );
64           while ( it.current() ) {
65               lst.append( it.current() );
66               ++it;
67           }
68
69       A QListViewItemIterator provides a convenient and easy way to traverse
70       a hierarchical QListView.
71
72       Multiple QListViewItemIterators can operate on the tree of
73       QListViewItems. A QListView knows about all iterators operating on its
74       QListViewItems. So when a QListViewItem gets removed all iterators that
75       point to this item are updated and point to the following item if
76       possible, otherwise to a valid item before the current one or to 0.
77       Note however that deleting the parent item of an item that an iterator
78       points to is not safe.
79
80       See also QListView, QListViewItem, and Advanced Widgets.
81
82   Member Type Documentation

QListViewItemIterator::IteratorFlag

84       These flags can be passed to a QListViewItemIterator constructor (OR-ed
85       together if more than one is used), so that the iterator will only
86       iterate over items that match the given flags.
87
88       QListViewItemIterator::Visible
89
90       QListViewItemIterator::Invisible
91
92       QListViewItemIterator::Selected
93
94       QListViewItemIterator::Unselected
95
96       QListViewItemIterator::Selectable
97
98       QListViewItemIterator::NotSelectable
99
100       QListViewItemIterator::DragEnabled
101
102       QListViewItemIterator::DragDisabled
103
104       QListViewItemIterator::DropEnabled
105
106       QListViewItemIterator::DropDisabled
107
108       QListViewItemIterator::Expandable
109
110       QListViewItemIterator::NotExpandable
111
112       QListViewItemIterator::Checked
113
114       QListViewItemIterator::NotChecked
115

MEMBER FUNCTION DOCUMENTATION

QListViewItemIterator::QListViewItemIterator ()

118       Constructs an empty iterator.
119

QListViewItemIterator::QListViewItemIterator ( QListViewItem * item )

121       Constructs an iterator for the QListView that contains the item. The
122       current iterator item is set to point to the item.
123

QListViewItemIterator::QListViewItemIterator ( QListViewItem * item, int

125       iteratorFlags )
126       Constructs an iterator for the QListView that contains the item using
127       the flags iteratorFlags. The current iterator item is set to point to
128       item or the next matching item if item doesn't match the flags.
129
130       See also QListViewItemIterator::IteratorFlag.
131

QListViewItemIterator::QListViewItemIterator ( const QListViewItemIterator &

133       it )
134       Constructs an iterator for the same QListView as it. The current
135       iterator item is set to point on the current item of it.
136

QListViewItemIterator::QListViewItemIterator ( QListView * lv )

138       Constructs an iterator for the QListView lv. The current iterator item
139       is set to point on the first child (QListViewItem) of lv.
140

QListViewItemIterator::QListViewItemIterator ( QListView * lv, int

142       iteratorFlags )
143       Constructs an iterator for the QListView lv with the flags
144       iteratorFlags. The current iterator item is set to point on the first
145       child (QListViewItem) of lv that matches the flags.
146
147       See also QListViewItemIterator::IteratorFlag.
148

QListViewItemIterator::~QListViewItemIterator ()

150       Destroys the iterator.
151

QListViewItem * QListViewItemIterator::current () const

153       Returns iterator's current item.
154
155       Examples:
156

QListViewItem * QListViewItemIterator::operator* ()

158       Dereference operator. Returns a reference to the current item. The same
159       as current().
160

QListViewItemIterator & QListViewItemIterator::operator++ ()

162       Prefix ++. Makes the next item the new current item and returns it.
163       Returns 0 if the current item is the last item or the QListView is 0.
164

const QListViewItemIterator QListViewItemIterator::operator++ ( int )

166       This is an overloaded member function, provided for convenience. It
167       behaves essentially like the above function.
168
169       Postfix ++. Makes the next item the new current item and returns the
170       item that was the current item.
171

QListViewItemIterator & QListViewItemIterator::operator+= ( int j )

173       Sets the current item to the item j positions after the current item.
174       If that item is beyond the last item, the current item is set to 0.
175       Returns the current item.
176

QListViewItemIterator & QListViewItemIterator::operator-- ()

178       Prefix --. Makes the previous item the new current item and returns it.
179       Returns 0 if the current item is the first item or the QListView is 0.
180

const QListViewItemIterator QListViewItemIterator::operator-- ( int )

182       This is an overloaded member function, provided for convenience. It
183       behaves essentially like the above function.
184
185       Postfix --. Makes the previous item the new current item and returns
186       the item that was the current item.
187

QListViewItemIterator & QListViewItemIterator::operator-= ( int j )

189       Sets the current item to the item j positions before the current item.
190       If that item is before the first item, the current item is set to 0.
191       Returns the current item.
192

QListViewItemIterator & QListViewItemIterator::operator= ( const

194       QListViewItemIterator & it )
195       Assignment. Makes a copy of it and returns a reference to its iterator.
196
197

SEE ALSO

199       http://doc.trolltech.com/qlistviewitemiterator.html
200       http://www.trolltech.com/faq/tech.html
201
203       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
204       license file included in the distribution for a complete license
205       statement.
206

AUTHOR

208       Generated automatically from the source code.
209

BUGS

211       If you find a bug in Qt, please report it as described in
212       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
213       help you. Thank you.
214
215       The definitive Qt documentation is provided in HTML format; it is
216       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
217       web browser. This man page is provided as a convenience for those users
218       who prefer man pages, although this format is not officially supported
219       by Trolltech.
220
221       If you find errors in this manual page, please report them to qt-
222       bugs@trolltech.com.  Please include the name of the manual page
223       (qlistviewitemiterator.3qt) and the Qt version (3.3.8).
224
225
226
227Trolltech AS                    2 February 2007     QListViewItemIterator(3qt)
Impressum