Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |
The TQLayoutIterator class provides iterators over TQLayoutItem. More...
#include <tqlayout.h>
Use TQLayoutItem::iterator() to create an iterator over a layout.
TQLayoutIterator uses explicit sharing with a reference count. If an iterator is copied and one of the copies is modified, both iterators will be modified.
A TQLayoutIterator is not protected against changes in its layout. If the layout is modified or deleted the iterator will become invalid. It is not possible to test for validity. It is safe to delete an invalid layout; any other access may lead to an illegal memory reference and the abnormal termination of the program.
Calling takeCurrent() or deleteCurrent() leaves the iterator in a valid state, but may invalidate any other iterators that access the same layout.
The following code will draw a rectangle for each layout item in the layout structure of the widget.
static void paintLayout( TQPainter *p, TQLayoutItem *lay ) { TQLayoutIterator it = lay->iterator(); TQLayoutItem *child; while ( (child = it.current()) != 0 ) { paintLayout( p, child ); ++it; } p->drawRect( lay->geometry() ); } void ExampleWidget::paintEvent( TQPaintEvent * ) { TQPainter p( this ); if ( layout() ) paintLayout( &p, layout() ); }
All the functionality of TQLayoutIterator is implemented by subclasses of TQGLayoutIterator. TQLayoutIterator itself is not designed to be subclassed.
See also Widget Appearance and Style and Layout Management.
Constructs an iterator based on gi. The constructed iterator takes ownership of gi and will delete it.
This constructor is provided for layout implementors. Application programmers should use TQLayoutItem::iterator() to create an iterator over a layout.
Creates a shallow copy of i, i.e. if the copy is modified, then the original will also be modified.
Destroys the iterator.
Returns the current item, or 0 if there is no current item.
Removes and deletes the current child item from the layout and moves the iterator to the next item. This iterator will still be valid, but any other iterator over the same layout may become invalid.
Moves the iterator to the next child item and returns that item, or 0 if there is no such item.
Assigns i to this iterator and returns a reference to this iterator.
Removes the current child item from the layout without deleting it, and moves the iterator to the next item. Returns the removed item, or 0 if there was no item to be removed. This iterator will still be valid, but any other iterator over the same layout may become invalid.
This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.
Copyright © 2007 Trolltech | Trademarks | TQt 3.3.8
|