I reply to my self, perhaps there is someone else which have the same kind of issue ;-)
In fact, it is quite easy, the solution is to use install an event filter on application level:
class MouseEventFilter : public QObject
{
Q_OBJECT
public:
explicit MouseEventFilter(QObject *parent = 0);
signals:
void recalibrateTouch();
public slots:
// QObject interface
public:
bool eventFilter(QObject *object, QEvent *event)
{
if(event->type() == QEvent::MouseButtonPress)
{
if(m_delay.hasExpired(5000))
{
m_clickCounter=0;
m_delay.start();
}
++m_clickCounter;
if(m_clickCounter == 10)
emit recalibrateTouch();
}
return QObject::eventFilter(object,event);
}
private:
int m_clickCounter;
QElapsedTimer m_delay;
};
Then simply install the event filter on application level like this:
app->installEventFilter(new MouseEventFilter(qApp));
That's it :)
Regards