[PyQt] Iterating over the contents of QGroupBox

David Boddie david at boddie.org.uk
Wed Mar 14 21:30:29 GMT 2007


On Wed Mar 14 05:25:38 GMT 2007, Tony Cappellini wrote:

> 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??????

It looks like the behaviour in PyQt differs from in Qt.

> x=self.ui.grpProgramArgs.findChildren(QCheckBox)
> 
>  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.

Try this to get all child widgets:

  x=self.ui.grpProgramArgs.findChildren(QWidget)

You can then examine each widget in turn to see what it is - the list will
contain all child objects whose classes are derived from QWidget.

David


More information about the PyQt mailing list