#ifndef MOUSEEVENTSPY_H #define MOUSEEVENTSPY_H #include #include /** * @brief Catches all mouse event and reports them via signal. * * Based on * https://stackoverflow.com/questions/46173105/how-can-i-reset-a-timer-every-time-i-receive-a-touch-event-from-a-qml-page */ class MouseEventSpy : public QObject { Q_OBJECT protected: explicit MouseEventSpy(QObject *parent = 0); signals: void mouseEventDetected(); public: static void init(); static MouseEventSpy* instance(); protected: bool eventFilter(QObject* watched, QEvent* event); private: bool isMouseEvent(QEvent::Type t); }; #endif // MOUSEEVENTSPY_H