1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
|
'\" t
.TH TQListViewItemIterator 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQListViewItemIterator \- Iterator for collections of TQListViewItems
.SH SYNOPSIS
\fC#include <tqlistview.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "enum \fBIteratorFlag\fR { Visible = 0x00000001, Invisible = 0x00000002, Selected = 0x00000004, Unselected = 0x00000008, Selectable = 0x00000010, NotSelectable = 0x00000020, DragEnabled = 0x00000040, DragDisabled = 0x00000080, DropEnabled = 0x00000100, DropDisabled = 0x00000200, Expandable = 0x00000400, NotExpandable = 0x00000800, Checked = 0x00001000, NotChecked = 0x00002000 }"
.br
.ti -1c
.BI "\fBTQListViewItemIterator\fR ()"
.br
.ti -1c
.BI "\fBTQListViewItemIterator\fR ( TQListViewItem * item )"
.br
.ti -1c
.BI "\fBTQListViewItemIterator\fR ( TQListViewItem * item, int iteratorFlags )"
.br
.ti -1c
.BI "\fBTQListViewItemIterator\fR ( const TQListViewItemIterator & it )"
.br
.ti -1c
.BI "\fBTQListViewItemIterator\fR ( TQListView * lv )"
.br
.ti -1c
.BI "\fBTQListViewItemIterator\fR ( TQListView * lv, int iteratorFlags )"
.br
.ti -1c
.BI "TQListViewItemIterator & \fBoperator=\fR ( const TQListViewItemIterator & it )"
.br
.ti -1c
.BI "\fB~TQListViewItemIterator\fR ()"
.br
.ti -1c
.BI "TQListViewItemIterator & \fBoperator++\fR ()"
.br
.ti -1c
.BI "const TQListViewItemIterator \fBoperator++\fR ( int )"
.br
.ti -1c
.BI "TQListViewItemIterator & \fBoperator+=\fR ( int j )"
.br
.ti -1c
.BI "TQListViewItemIterator & \fBoperator--\fR ()"
.br
.ti -1c
.BI "const TQListViewItemIterator \fBoperator--\fR ( int )"
.br
.ti -1c
.BI "TQListViewItemIterator & \fBoperator-=\fR ( int j )"
.br
.ti -1c
.BI "TQListViewItem * \fBoperator*\fR ()"
.br
.ti -1c
.BI "TQListViewItem * \fBcurrent\fR () const"
.br
.in -1c
.SH DESCRIPTION
The TQListViewItemIterator class provides an iterator for collections of TQListViewItems.
.PP
Construct an instance of a TQListViewItemIterator, with either a TQListView* or a TQListViewItem* as argument, to operate on the tree of TQListViewItems, starting from the argument.
.PP
A TQListViewItemIterator iterates over all the items from its starting point. This means that it always makes the first child of the current item the new current item. If there is no child, the next sibling becomes the new current item; and if there is no next sibling, the next sibling of the parent becomes current.
.PP
The following example creates a list of all the items that have been selected by the user, storing pointers to the items in a TQPtrList:
.PP
.nf
.br
TQPtrList<TQListViewItem> lst;
.br
TQListViewItemIterator it( myListView );
.br
while ( it.current() ) {
.br
if ( it.current()->isSelected() )
.br
lst.append( it.current() );
.br
++it;
.br
}
.br
.fi
.PP
An alternative approach is to use an IteratorFlag:
.PP
.nf
.br
TQPtrList<TQListViewItem> lst;
.br
TQListViewItemIterator it( myListView, TQListViewItemIterator::Selected );
.br
while ( it.current() ) {
.br
lst.append( it.current() );
.br
++it;
.br
}
.br
.fi
.PP
A TQListViewItemIterator provides a convenient and easy way to traverse a hierarchical TQListView.
.PP
Multiple TQListViewItemIterators can operate on the tree of TQListViewItems. A TQListView knows about all iterators operating on its TQListViewItems. So when a TQListViewItem gets removed all iterators that point to this item are updated and point to the following item if possible, otherwise to a valid item before the current one or to 0. Note however that deleting the parent item of an item that an iterator points to is not safe.
.PP
See also TQListView, TQListViewItem, and Advanced Widgets.
.SS "Member Type Documentation"
.SH "TQListViewItemIterator::IteratorFlag"
These flags can be passed to a TQListViewItemIterator constructor (OR-ed together if more than one is used), so that the iterator will only iterate over items that match the given flags.
.TP
\fCTQListViewItemIterator::Visible\fR
.TP
\fCTQListViewItemIterator::Invisible\fR
.TP
\fCTQListViewItemIterator::Selected\fR
.TP
\fCTQListViewItemIterator::Unselected\fR
.TP
\fCTQListViewItemIterator::Selectable\fR
.TP
\fCTQListViewItemIterator::NotSelectable\fR
.TP
\fCTQListViewItemIterator::DragEnabled\fR
.TP
\fCTQListViewItemIterator::DragDisabled\fR
.TP
\fCTQListViewItemIterator::DropEnabled\fR
.TP
\fCTQListViewItemIterator::DropDisabled\fR
.TP
\fCTQListViewItemIterator::Expandable\fR
.TP
\fCTQListViewItemIterator::NotExpandable\fR
.TP
\fCTQListViewItemIterator::Checked\fR
.TP
\fCTQListViewItemIterator::NotChecked\fR
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQListViewItemIterator::TQListViewItemIterator ()"
Constructs an empty iterator.
.SH "TQListViewItemIterator::TQListViewItemIterator ( TQListViewItem * item )"
Constructs an iterator for the TQListView that contains the \fIitem\fR. The current iterator item is set to point to the \fIitem\fR.
.SH "TQListViewItemIterator::TQListViewItemIterator ( TQListViewItem * item, int iteratorFlags )"
Constructs an iterator for the TQListView that contains the \fIitem\fR using the flags \fIiteratorFlags\fR. The current iterator item is set to point to \fIitem\fR or the next matching item if \fIitem\fR doesn't match the flags.
.PP
See also TQListViewItemIterator::IteratorFlag.
.SH "TQListViewItemIterator::TQListViewItemIterator ( const TQListViewItemIterator & it )"
Constructs an iterator for the same TQListView as \fIit\fR. The current iterator item is set to point on the current item of \fIit\fR.
.SH "TQListViewItemIterator::TQListViewItemIterator ( TQListView * lv )"
Constructs an iterator for the TQListView \fIlv\fR. The current iterator item is set to point on the first child (TQListViewItem) of \fIlv\fR.
.SH "TQListViewItemIterator::TQListViewItemIterator ( TQListView * lv, int iteratorFlags )"
Constructs an iterator for the TQListView \fIlv\fR with the flags \fIiteratorFlags\fR. The current iterator item is set to point on the first child (TQListViewItem) of \fIlv\fR that matches the flags.
.PP
See also TQListViewItemIterator::IteratorFlag.
.SH "TQListViewItemIterator::~TQListViewItemIterator ()"
Destroys the iterator.
.SH "TQListViewItem * TQListViewItemIterator::current () const"
Returns iterator's current item.
.PP
Examples:
.)l addressbook/centralwidget.cpp, checklists/checklists.cpp, and dirview/dirview.cpp.
.SH "TQListViewItem * TQListViewItemIterator::operator* ()"
Dereference operator. Returns a reference to the current item. The same as current().
.SH "TQListViewItemIterator & TQListViewItemIterator::operator++ ()"
Prefix ++. Makes the next item the new current item and returns it. Returns 0 if the current item is the last item or the TQListView is 0.
.SH "const TQListViewItemIterator TQListViewItemIterator::operator++ ( int )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Postfix ++. Makes the next item the new current item and returns the item that \fIwas\fR the current item.
.SH "TQListViewItemIterator & TQListViewItemIterator::operator+= ( int j )"
Sets the current item to the item \fIj\fR positions after the current item. If that item is beyond the last item, the current item is set to 0. Returns the current item.
.SH "TQListViewItemIterator & TQListViewItemIterator::operator-- ()"
Prefix --. Makes the previous item the new current item and returns it. Returns 0 if the current item is the first item or the TQListView is 0.
.SH "const TQListViewItemIterator TQListViewItemIterator::operator-- ( int )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Postfix --. Makes the previous item the new current item and returns the item that \fIwas\fR the current item.
.SH "TQListViewItemIterator & TQListViewItemIterator::operator-= ( int j )"
Sets the current item to the item \fIj\fR positions before the current item. If that item is before the first item, the current item is set to 0. Returns the current item.
.SH "TQListViewItemIterator & TQListViewItemIterator::operator= ( const TQListViewItemIterator & it )"
Assignment. Makes a copy of \fIit\fR and returns a reference to its
iterator.
.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqlistviewitemiterator.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (tqlistviewitemiterator.3qt) and the Qt
version (3.3.8).
|