[PyKDE] Re: QEvent.User

Phil Thompson phil at riverbankcomputing.co.uk
Mon Feb 13 19:23:25 GMT 2006


On Thursday 09 February 2006 10:04 pm, Patrick Stinson wrote:
> Also, QEvent() won't tak an integer as an argument, only a
> PyQt4.QtCore.QEvent.Type object, and you are supposed to be able to use a
> range between QEvent.User and QEvent.MaxUser.
>
> Python 2.4.2 (#1, Dec 13 2005, 10:02:01)
> [GCC 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from PyQt4.QtCore import QEvent
> >>> EVENT_CPU_EXPLOSION = QEvent.User + 1
> >>> QEvent(EVENT_CPU_EXPLOSION)
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: argument 1 of QEvent() has an invalid type

You need to create an argument of the correct type...

EVENT_CPU_EXPLOSION = QEvent.Type(QEvent.User + 1)

Phil




More information about the PyQt mailing list