[PyKDE] QObject.findChildren doesn't work as expected with QRegExp
Kerri Reno
kreno at yumaed.org
Fri Mar 2 02:53:45 GMT 2007
I have the following code:
def testfindChildren(self):
hLayout = QtGui.QHBoxLayout()
hLayout.setObjectName('hLayout_0')
self.searchLayout.addLayout(hLayout)
print self.findChild(QtGui.QHBoxLayout,'hLayout_0')
children = self.findChildren(QtGui.QHBoxLayout,QtCore.QRegExp('\w*'))
for c in children:
print c.objectName()
print self.findChildren(QtGui.QHBoxLayout,QtCore.QRegExp('hLayout_\d'))
that gives me the following output:
<PyQt4.QtGui.QHBoxLayout object at 0x019F0B70>
hLayout_0
[]
The first line is returned from the findChild, the second (hLayout_0)
and third (blank line) are returned from print c.objectName().
The one I need, findChildren with a QRegex does not return hLayout_0 in
the list. Am I doing something wrong here? Is this a bug? I can't see
anything in the docs that explains what's happening.
TIA,
Kerri
Yuma Educational Computer Consortium
Compass Development Team
Kerri Reno
kreno at yumaed.org (928) 502-4240
More information about the PyQt
mailing list