parent
3d55cc72a2
commit
849bde68e4
@ -1,10 +1,12 @@
|
|||||||
HEADERS += \
|
HEADERS += \
|
||||||
$$PWD/controlevent.h \
|
$$PWD/controlevent.h \
|
||||||
$$PWD/controller.h \
|
$$PWD/controller.h \
|
||||||
$$PWD/inputconvert.h
|
$$PWD/inputconvert.h \
|
||||||
|
$$PWD/inputconvertbase.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/controlevent.cpp \
|
$$PWD/controlevent.cpp \
|
||||||
$$PWD/controller.cpp \
|
$$PWD/controller.cpp \
|
||||||
$$PWD/inputconvert.cpp
|
$$PWD/inputconvert.cpp \
|
||||||
|
$$PWD/inputconvertbase.cpp
|
||||||
|
|
||||||
|
|||||||
@ -1,27 +1,22 @@
|
|||||||
#ifndef INPUTCONVERT_H
|
#ifndef INPUTCONVERT_H
|
||||||
#define INPUTCONVERT_H
|
#define INPUTCONVERT_H
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include "inputconvertbase.h"
|
||||||
#include <QWheelEvent>
|
|
||||||
#include <QKeyEvent>
|
|
||||||
|
|
||||||
#include "controlevent.h"
|
class InputConvert : public InputConvertBase
|
||||||
|
|
||||||
class InputConvert
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InputConvert();
|
InputConvert();
|
||||||
|
virtual ~InputConvert();
|
||||||
|
|
||||||
// the frame size may be different from the real device size, so we need the size
|
ControlEvent* mouseEvent(const QMouseEvent* from, const QSize& frameSize, const QSize& showSize);
|
||||||
// to which the absolute position apply, to scale it accordingly
|
ControlEvent* wheelEvent(const QWheelEvent* from, const QSize& frameSize, const QSize& showSize);
|
||||||
static ControlEvent* mouseEvent(const QMouseEvent* from, const QSize& frameSize, const QSize& showSize);
|
ControlEvent* keyEvent(const QKeyEvent* from);
|
||||||
static ControlEvent* wheelEvent(const QWheelEvent* from, const QSize& frameSize, const QSize& showSize);
|
|
||||||
static ControlEvent* keyEvent(const QKeyEvent* from);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static AndroidMotioneventButtons convertMouseButtons(Qt::MouseButtons buttonState);
|
AndroidMotioneventButtons convertMouseButtons(Qt::MouseButtons buttonState);
|
||||||
static AndroidKeycode convertKeyCode(int key, Qt::KeyboardModifiers modifiers);
|
AndroidKeycode convertKeyCode(int key, Qt::KeyboardModifiers modifiers);
|
||||||
static AndroidMetastate convertMetastate(Qt::KeyboardModifiers modifiers);
|
AndroidMetastate convertMetastate(Qt::KeyboardModifiers modifiers);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INPUTCONVERT_H
|
#endif // INPUTCONVERT_H
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
#include "inputconvertbase.h"
|
||||||
|
|
||||||
|
InputConvertBase::InputConvertBase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
InputConvertBase::~InputConvertBase()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef INPUTCONVERTBASE_H
|
||||||
|
#define INPUTCONVERTBASE_H
|
||||||
|
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
#include "controlevent.h"
|
||||||
|
|
||||||
|
class InputConvertBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
InputConvertBase();
|
||||||
|
virtual ~InputConvertBase();
|
||||||
|
|
||||||
|
// the frame size may be different from the real device size, so we need the size
|
||||||
|
// to which the absolute position apply, to scale it accordingly
|
||||||
|
virtual ControlEvent* mouseEvent(const QMouseEvent* from, const QSize& frameSize, const QSize& showSize) = 0;
|
||||||
|
virtual ControlEvent* wheelEvent(const QWheelEvent* from, const QSize& frameSize, const QSize& showSize) = 0;
|
||||||
|
virtual ControlEvent* keyEvent(const QKeyEvent* from) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INPUTCONVERTBASE_H
|
||||||
Loading…
Reference in new issue