[PyKDE] event filters

Phil Thompson phil at riverbankcomputing.co.uk
Wed Oct 15 18:48:00 BST 2003


On Wednesday 15 October 2003 5:40 pm, Toby Dickenson wrote:
> Im not seeing event filters work how I expected. In the following script I
> am seeing the 'event' line but *never* the 'filter' line. PyQt 3.8, qt
> 3.1.2, on windows and X.
>
> Any ideas? Thanks in advance.
>
>
> from qt import *
>
> class F(QObject):
>     def eventFilter(self,ob,ev):
>         print 'filter',ob,ev,'but Ive never seen this working'
>         return 0
>     def event(self,ev):
>         print 'event',ev
>         return 0
>
> app = QApplication([])
>
> f1 = F()
> f2 = F()
> f1.installEventFilter(f2)
>
> app.sendEvent(f1,QCustomEvent(QEvent.User))

You aren't calling QObject.__init__().

Phil




More information about the PyQt mailing list