[PyKDE] Problem with QLayout in PyQt4

Phil Thompson phil at riverbankcomputing.co.uk
Sun Dec 11 18:24:29 GMT 2005


On Saturday 10 December 2005 5:06 pm, Baz Walter wrote:
> 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?

There isn't a base class method - it's pure virtual. This is the expected 
behaviour.

Phil

Phil




More information about the PyQt mailing list