PDA

View Full Version : catch global mouse press event



nick85
15th June 2011, 11:23
Hi all,

(sorry for my english)
I am developing an application in qt 4.7.2 under linux. This application is used on a touch screen (mouse cursor may not be present) and it's composed of many classes.

Since this application works on very slow processors, I'm going to give to user an instant feedback of press action through the appearance of a small red circle for a few tenths of a second in that point.

I know that i can capture and override mouse press event and get the position (and also global position) of cursor, but this only works in this widget's area.

What I want to avoid is having to overwrite all mousePressEvent of all widgets with some kind of manager (or widget?) that works on top of all the widgets included in the window.

There is a way to do this? Or, alternatively, another way to do this?

thanks all,

Nicola

stampede
15th June 2011, 12:28
You can install event filter (http://doc.qt.nokia.com/latest/qobject.html#installEventFilter) on QApplication object, this way you can avoid "having to overwrite all mousePressEvent of all widgets".

nick85
15th June 2011, 12:32
thanks I try

nick85
15th June 2011, 14:37
works! thanks again