Restart timer on mouse event.

Todo: call shut down script on timeout
This commit is contained in:
Anika Raemer 2019-04-03 20:05:48 +02:00
parent 420a5ee428
commit ce8ea8f582
2 changed files with 66 additions and 13 deletions

View file

@ -2,6 +2,8 @@
#define MOUSEEVENTSPY_H
#include <QObject>
#include <QTimer>
#include <QEvent>
/**
* Catches all mouse event and starts timer -- basically behaves like a screensaver.
@ -20,6 +22,14 @@ public:
protected:
bool eventFilter(QObject* watched, QEvent* event);
private:
void initTimer(int interval);
bool isMouseEvent(QEvent::Type t);
QTimer mTimer;
private slots:
void onTimeout();
signals:
void mouseEventDetected();
};