void BrowseChildren
( QWidget * parent
) {
QObjectList children = parent->children();
QObjectList::const_iterator it = children.begin();
QObjectList::const_iterator eIt = children.end();
while ( it != eIt )
{
BrowseChildren( pChild );
}
}
void BrowseChildren( QWidget * parent )
{
QObjectList children = parent->children();
QObjectList::const_iterator it = children.begin();
QObjectList::const_iterator eIt = children.end();
while ( it != eIt )
{
QWidget * pChild = (QWidget *)(*it++);
BrowseChildren( pChild );
}
}
To copy to clipboard, switch view to plain text mode
Of course, you might want to do something with each child widget as it is discovered. Read the docs: the order of the list is determined by the stacking order of the widgets. Bringing a widget to the top of the stack by raising it changes the order.
Bookmarks