Added MouseEventSpy as base for an auto shutdown
This commit is contained in:
parent
d251120275
commit
420a5ee428
4 changed files with 79 additions and 2 deletions
27
LenaPi/MouseEventSpy.h
Normal file
27
LenaPi/MouseEventSpy.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef MOUSEEVENTSPY_H
|
||||
#define MOUSEEVENTSPY_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
/**
|
||||
* Catches all mouse event and starts timer -- basically behaves like a screensaver.
|
||||
* Based on
|
||||
* https://stackoverflow.com/questions/46173105/how-can-i-reset-a-timer-every-time-i-receive-a-touch-event-from-a-qml-page
|
||||
*
|
||||
* @todo implement timer and behavior on timeout.
|
||||
*/
|
||||
class MouseEventSpy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MouseEventSpy(QObject *parent = 0);
|
||||
static MouseEventSpy* instance();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject* watched, QEvent* event);
|
||||
|
||||
signals:
|
||||
void mouseEventDetected();
|
||||
};
|
||||
|
||||
#endif // MOUSEEVENTSPY_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue