1QLayoutIterator(3qt) QLayoutIterator(3qt)
2
3
4
6 QLayoutIterator - Iterators over QLayoutItem
7
9 #include <qlayout.h>
10
11 Public Members
12 QLayoutIterator ( QGLayoutIterator * gi )
13 QLayoutIterator ( const QLayoutIterator & i )
14 ~QLayoutIterator ()
15 QLayoutIterator & operator= ( const QLayoutIterator & i )
16 QLayoutItem * operator++ ()
17 QLayoutItem * current ()
18 QLayoutItem * takeCurrent ()
19 void deleteCurrent ()
20
22 The QLayoutIterator class provides iterators over QLayoutItem.
23
24 Use QLayoutItem::iterator() to create an iterator over a layout.
25
26 QLayoutIterator uses explicit sharing with a reference count. If an
27 iterator is copied and one of the copies is modified, both iterators
28 will be modified.
29
30 A QLayoutIterator is not protected against changes in its layout. If
31 the layout is modified or deleted the iterator will become invalid. It
32 is not possible to test for validity. It is safe to delete an invalid
33 layout; any other access may lead to an illegal memory reference and
34 the abnormal termination of the program.
35
36 Calling takeCurrent() or deleteCurrent() leaves the iterator in a valid
37 state, but may invalidate any other iterators that access the same
38 layout.
39
40 The following code will draw a rectangle for each layout item in the
41 layout structure of the widget.
42
43 static void paintLayout( QPainter *p, QLayoutItem *lay )
44 {
45 QLayoutIterator it = lay->iterator();
46 QLayoutItem *child;
47 while ( (child = it.current()) != 0 ) {
48 paintLayout( p, child );
49 ++it;
50 }
51 p->drawRect( lay->geometry() );
52 }
53 void ExampleWidget::paintEvent( QPaintEvent * )
54 {
55 QPainter p( this );
56 if ( layout() )
57 paintLayout( &p, layout() );
58 }
59
60 All the functionality of QLayoutIterator is implemented by subclasses
61 of QGLayoutIterator. QLayoutIterator itself is not designed to be
62 subclassed.
63
64 See also Widget Appearance and Style and Layout Management.
65
68 Constructs an iterator based on gi. The constructed iterator takes
69 ownership of gi and will delete it.
70
71 This constructor is provided for layout implementors. Application
72 programmers should use QLayoutItem::iterator() to create an iterator
73 over a layout.
74
76 Creates a shallow copy of i, i.e. if the copy is modified, then the
77 original will also be modified.
78
80 Destroys the iterator.
81
83 Returns the current item, or 0 if there is no current item.
84
86 Removes and deletes the current child item from the layout and moves
87 the iterator to the next item. This iterator will still be valid, but
88 any other iterator over the same layout may become invalid.
89
91 Moves the iterator to the next child item and returns that item, or 0
92 if there is no such item.
93
95 Assigns i to this iterator and returns a reference to this iterator.
96
98 Removes the current child item from the layout without deleting it, and
99 moves the iterator to the next item. Returns the removed item, or 0 if
100 there was no item to be removed. This iterator will still be valid, but
101 any other iterator over the same layout may become invalid.
102
103
105 http://doc.trolltech.com/qlayoutiterator.html
106 http://www.trolltech.com/faq/tech.html
107
109 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
110 license file included in the distribution for a complete license
111 statement.
112
114 Generated automatically from the source code.
115
117 If you find a bug in Qt, please report it as described in
118 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
119 help you. Thank you.
120
121 The definitive Qt documentation is provided in HTML format; it is
122 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
123 web browser. This man page is provided as a convenience for those users
124 who prefer man pages, although this format is not officially supported
125 by Trolltech.
126
127 If you find errors in this manual page, please report them to qt-
128 bugs@trolltech.com. Please include the name of the manual page
129 (qlayoutiterator.3qt) and the Qt version (3.3.8).
130
131
132
133Trolltech AS 2 February 2007 QLayoutIterator(3qt)