tags:

views:

202

answers:

2

I want to catch all events for the application. How can i use this method to achive this? Please help me !!

+1  A: 

You have to implement and provide a function and point to it.

For example:

bool myEventFilter(void *message, long *result)
{
  // do something with message and result
}

And call it like this:

app->setEventFilter( myEventFilter );
Rupert Jones
Thanks for answer. but with this implemention i am not able to catch any Event other than timer.
Shabs
According to the documentation http://doc.trolltech.com/4.6/qcoreapplication.html#setEventFilter it should catch all events. I haven't tried it out properly though.
Rupert Jones
Thanks a lot ... its working now..
Shabs
+2  A: 

QCoreApplication inherits QObject, so you can call QCoreApplication::installEventFilter(QObject*). For further reference about event filters, see here.

erelender
With this implementation I am facing a problem... I want to just monitor all Mouseclicks, but if a subclass handling 'MouseClick' then that event message is not handled in eventFilter(). Can you help me to understand this functionality.Thanks for the help.
Shabs