Restart timer on mouse event.
Todo: call shut down script on timeout
This commit is contained in:
parent
420a5ee428
commit
ce8ea8f582
2 changed files with 66 additions and 13 deletions
|
|
@ -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();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue