[Qt-interest] Problem with QGraphicsView and eventFilter

Ender EREL erelender at yahoo.com
Fri Mar 12 15:38:52 CET 2010


Hello everyone,

This has been bugging me for more than two days now, so i thought i 
should ask. I am using Qt 4.5.3 (compiled with VC2008) on Win7.

I have MyGraphicsView (inherits QGraphicsView) and MyFilter (inherits 
QObject) classes.

When i install the MyFilter object as an event filter to MyGraphicsView, 
Mouse events are delivered to MyFilter *after* they are delivered to 
MyGraphicsView whereas Key events are delivered to MyFilter *before* 
they are delivered to MyGraphicsView.

In the second case, i install the MyFilter object as an event filter to 
MyGraphicsView->viewport() (which is a standart QGLWidget), Mouse events 
are delivered to MyFilter *before* they are delivered to MyGraphicsView, 
whereas Key events are delivered to *only* MyGraphicsView.

I am sending a small compilable example (with both .vcproj and .pro, 
hope .pro works).

I believe events are supposed to be delivered to event filters before 
they are delivered to the actual object, so why is this happening? What 
should i do to ensure this order?

Thanks in advance.
Best Regards.

-- 
Ender EREL



More information about the Qt-interest-old mailing list