[PyQt] Newbie's question about inheritance in QtPy4 classes
ipesando at gmail.com
Wed Aug 18 20:15:20 BST 2010
sorry to bother but I'm learning PyQt4 and designer.
Playing with the code suggested in some tutorials I came with the code below
which should NOT work according to my understanding of inheritance but it works.
The problem is that the class MyForm inherits from QMainWindow which
does not inherit from QDockWidget even if they both inherit from
Therefore QtGui.QDockWidget.__init__(self, parent) should fail but
everything works fine.
As a matter of fact I tried a similar construction within plain
python and I get an error message.
So the question is why QtGui.QDockWidget.__init__(self, parent) works?
from PyQt4 import QtCore, QtGui
def __init__(self, parent=None):
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
myapp = MyForm()
Thanks in advance
More information about the PyQt