[PyQt] Difficulty inheriting QEvent

Christoph Burgmer chrislb at gmx.de
Fri Jan 16 02:30:37 GMT 2009


Am Friday, 16. January 2009 schrieb Zac Burns:
> I'm trying to create and dispatch a custom event. If I try to inherit
> from QEvent like so:
>
> class X(qt.QEvent):
> 	def __init__(self):
> 		qt.QEvent.__init__(self, 1500)
>
> x = X()
>
> Then I get "# TypeError: argument 1 of QEvent() has an invalid type # "



Works for me with v4.4.2 when doing
from PyQt4 import QtCore as qt
before that.

> Or, if I omit the initialization than the object can be created.
>
> x = X()
>
> However, when I try to dispatch the event using:
>
> app.postEvent(app, x)
>
> I get "# RuntimeError: underlying C/C++ object has been deleted # "
>
> What is going on here?

Standard error when you fail to initialise your parent class like
class X(qt.QEvent):
    def __init__(self):
        pass

Christoph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090116/3ed52e50/attachment.html


More information about the PyQt mailing list