[PyKDE] Problem with QLayout in PyQt4

Baz Walter bazwal at ftml.net
Sat Dec 10 17:06:39 GMT 2005


When porting some of the layout examples I came across a problem with calling 
baseclass methods for QLayout. Here's some code to illustrate:

>>> from PyQt4 import QtCore, QtGui
>>> app = QtGui.QApplication([])
>>> class widget(QtGui.QWidget):
...     def __init__(self):
...         QtGui.QWidget.__init__(self)
...     def setGeometry(self, rect):
...         QtGui.QWidget.setGeometry(self, rect)
...
>>> class layout(QtGui.QLayout):
...     def __init__(self):
...         QtGui.QLayout.__init__(self)
...     def setGeometry(self, rect):
...         QtGui.QLayout.setGeometry(self, rect)
...
>>> widget().setGeometry(QtCore.QRect(0,0,100,100))
>>> layout().setGeometry(QtCore.QRect(0,0,100,100))
RuntimeError: maximum recursion depth exceeded
>>>


Looks like the reimplemented method is being called instead of the baseclass 
method - can this be fixed?


Regards
-- 
Baz Walter




More information about the PyQt mailing list