[PyKDE] event filters

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Wed Oct 15 18:56:01 BST 2003


On Wednesday 15 October 2003 17:46, Phil Thompson wrote:
> 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__().

On my two instances of the class F?

Im not calling __init__, but python will do when I create the instances 
surely.

I dont think Im missing anything that fundamental.

-- 
Toby Dickenson




More information about the PyQt mailing list