- Add app icon - prevend android device from shutting down cpu while playing music - fix scaling bug - fix energy saver for RasPi by reconnecting to music player - minor refactorings and renaming
44 lines
903 B
C++
44 lines
903 B
C++
#include "MouseEventSpy.h"
|
|
|
|
#include <QGuiApplication>
|
|
#include <QDebug>
|
|
|
|
void MouseEventSpy::init()
|
|
{
|
|
instance();
|
|
}
|
|
|
|
|
|
MouseEventSpy* MouseEventSpy::instance()
|
|
{
|
|
static MouseEventSpy* inst;
|
|
if (!inst)
|
|
{
|
|
inst = new MouseEventSpy();
|
|
QGuiApplication* app = qGuiApp;
|
|
app->installEventFilter(inst);
|
|
}
|
|
return inst;
|
|
}
|
|
|
|
|
|
bool MouseEventSpy::eventFilter(QObject* watched, QEvent* event)
|
|
{
|
|
QEvent::Type t = event->type();
|
|
if (isMouseEvent(t)
|
|
&& event->spontaneous() // Take only mouse events from outside of Qt
|
|
)
|
|
{
|
|
emit mouseEventDetected();
|
|
}
|
|
return QObject::eventFilter(watched, event);
|
|
}
|
|
|
|
|
|
bool MouseEventSpy::isMouseEvent(QEvent::Type t)
|
|
{
|
|
return (t == QEvent::MouseButtonDblClick
|
|
|| t == QEvent::MouseButtonPress
|
|
|| t == QEvent::MouseButtonRelease
|
|
|| t == QEvent::MouseMove);
|
|
}
|