[PyQt] bug with setTabOrder?

Kerri Reno kreno at yumaed.org
Wed Mar 21 19:51:19 GMT 2007


I sent this to the old mailing list (before it moved), and got no
response.  Trying again.

According to the docs, setTabOrder is defined as:
QWidget.setTabOrder(QWidget,QWidget)

but I get:
    self.setTabOrder(a,b)
TypeError: setTabOrder() takes exactly 1 argument (3 given)


Kerri

Yuma Educational Computer Consortium
Compass Development Team
Kerri Reno
kreno at yumaed.org      (928) 502-4240




Kerri Reno wrote:
> Phil,
>
> I tried using raw strings, and got the same output.  Attached is a 
> full example.
>
> Kerri
>
> Yuma Educational Computer Consortium
> Compass Development Team
> Kerri Reno
> kreno at yumaed.org      (928) 502-4240
>
>
>
>
> Phil Thompson wrote:
>> On Friday 02 March 2007 2:53 am, Kerri Reno wrote:
>>  
>>> 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.
>>>     
>>
>> The escaping is certainly wrong - try using raw strings.
>>
>> Otherwise post a complete example that demonstrates the problem.
>>
>> Phil
>>
>> _______________________________________________
>> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
>> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>>
>>   
> ------------------------------------------------------------------------
>
> import sys
> from PyQt4 import QtGui, QtCore
>
> class testFindChildren(QtGui.QDialog):
>
> 	def __init__(self):
> 		QtGui.QDialog.__init__(self)
> 		self.setWindowModality(QtCore.Qt.WindowModal)
>
> 		self.searchLayout = QtGui.QVBoxLayout(self)
>
> 		hLayout = QtGui.QHBoxLayout()
> 		hLayout.setObjectName('hLayout_0')
> 		self.searchLayout.addLayout(hLayout)
>
> 		print self.findChild(QtGui.QHBoxLayout,r'hLayout_0')
> 		children = self.findChildren(QtGui.QHBoxLayout,QtCore.QRegExp(r'\w*'))
> 		for c in children:
> 			print c.objectName()
> 		print self.findChildren(QtGui.QHBoxLayout,QtCore.QRegExp(r'hLayout_\d'))
>
>
> def main(args):
> 	app = QtGui.QApplication(args)
> 	mainWindow = testFindChildren()
>
> 	mainWindow.show()
> 	sys.exit(app.exec_())
>
> if __name__ == '__main__':
> 	main(sys.argv)
>
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
>   





More information about the PyQt mailing list