[PyQt] Iterating over the contents of QGroupBox
cappy2112 at gmail.com
Wed Mar 14 05:25:38 GMT 2007
>>Well, all of these are childs of the QGroupBox, so you can use QObjects
>>methods to get the childs and iterate over those. Be aware that this
>>list may contain childs other than the ones you expect it to be.
>From the docs for QObject::findChildren
QList<T> QObject::findChildren ( const QString & name = QString() ) const
Returns all children of this object with the given name that can be
cast to type T, or an empty list if there are no such objects. An
empty string matches all object names. The search is performed
Here's what I tried with an empty string to get all of the objects
Traceback (most recent call last):
File "<string>", line 1, in <string>
TypeError: argument 1 of QObject.findChildren() has an invalid type
Out of desperation, I also tried
all with the same result.
So are the docs wrong regarding an empty string, am I doing it wrong,
or is there a bug?
findChild() has the same problem- regarding passing an empty string.
Perhaps the docs mean to state an empty QString??????
returned all of the QCheckBox objects, so I can now iterate over
them, but I would like to understand if it really is possible to get
all the children objects with just one call, especially if the
children are different types.
More information about the PyQt