[PyQt] PyQt overloaded constructors
Georg Altmann
george at george-net.de
Tue Sep 30 14:27:20 BST 2008
Hello,
I want to subclass QUndoCommand in python which has two overloaded
constructors:
QUndoCommand ( QUndoCommand * parent = 0 );
QUndoCommand ( const QString & text, QUndoCommand * parent = 0 );
The PyQt documentation for QUndoCommand has:
__init__ (self, QUndoCommand parent = None)
__init__ (self, QString text, QUndoCommand parent = None)
My python knowledge is shallow, but AFAIK python does not support
constructor/method overloading directly. I didn't find any info on
overloaded functions in the SIP docs - what magic makes this possible here?
The following is not support by python (the second __init__ overrides
the first one):
class InsertCommand(QUndoCommand):
def __init__(self, list, item, pos, parent = None):
pass
def __init__(self, text, list, item, pos, parent = None):
pass
Can I support the overloaded constructors in my subclass?
Regards
Georg
More information about the PyQt
mailing list