[PyQt] Difficulty inheriting QEvent

Zac Burns zac256 at gmail.com
Fri Jan 16 17:15:59 GMT 2009


Thank you, this answer worked. I will also upgrade to the latest version.

--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games



On Fri, Jan 16, 2009 at 1:01 AM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On Thu, 15 Jan 2009 17:45:06 -0800, "Zac Burns" <zac256 at gmail.com> wrote:
>> Greetings,
>>
>> 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 # "
>>
>> 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?
>
> You don't give any version information.
>
> The argument is an enum, not an int. Newer versions of SIP will
> automatically do the conversion. Older versions require an explicit cast
> (ie. qt.QEvent.Type(1500)).
>
> Phil
>


More information about the PyQt mailing list