[PyQt] can't get findChild to work
Danny Shevitz
shevitz at lanl.gov
Tue Jun 8 23:29:53 BST 2010
Howdy,
Another newbie question here. I am trying to get findChild to work. The code
I am trying is
app=QtGui.QApplication.instance()
print app.allWidgets()
mdiArea=app.findChild(QtGui.QMdiArea)
print "in ElicitorPage, mdiArea = ", mdiArea
As can be seen, I am getting the global application object, then printing
all of its widgets (it is an MDI application with
a QMdiArea widget as the central widget). Then I try to find the QMdiArea
widget. I don't believe I need a name in findChild
since the defaults to "" which matches all instances. I also tried with a
name, and it didn't work for me anyway. In any case, here is the output
of the code:
[<PyQt4.QtGui.QMenu object at 0x013F4108>, <PyQt4.QtGui.QMenu object at
0x013F4078>, .
<PyQt4.QtGui.QMdiArea object at 0x013D1AE0>]
in ElicitorPage, mdiArea = None
As you can see, there is clearly a QMdiArea widget in app.allWidgets, and
yet the findChild method doesn't return it.
Can anyone tell me what I am doing wrong?
Thanks,
Danny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20100608/35109666/attachment.html>
More information about the PyQt
mailing list