[PyQt] staticMetaObject

Phil Thompson phil at riverbankcomputing.com
Thu Mar 29 14:12:33 BST 2012


On Thu, 29 Mar 2012 13:44:06 +0200, Kermit <stef.kermit at gmail.com> wrote:
> Hi PyQt community,
> 
> i can't understand why staticMetaObject isn't know in __new__
construction

A sip type isn't completely ready until the meta-type's __init__ method
has run. Therefore if you want to look at staticMetaObject before an
instance of the type is created then reimplement __init__ rather than
__new__.

class MetaKlass(QtCore.pyqtWrapperType):
    def __init__(self, name, bases, d):
        QtCore.pyqtWrapperType.__init__(self, name, bases, d)

        meta = self.staticMetaObject

Phil


More information about the PyQt mailing list