parent
3d55cc72a2
commit
849bde68e4
@ -1,10 +1,12 @@
|
||||
HEADERS += \
|
||||
$$PWD/controlevent.h \
|
||||
$$PWD/controller.h \
|
||||
$$PWD/inputconvert.h
|
||||
$$PWD/inputconvert.h \
|
||||
$$PWD/inputconvertbase.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/controlevent.cpp \
|
||||
$$PWD/controller.cpp \
|
||||
$$PWD/inputconvert.cpp
|
||||
$$PWD/inputconvert.cpp \
|
||||
$$PWD/inputconvertbase.cpp
|
||||
|
||||
|
||||
@ -1,27 +1,22 @@
|
||||
#ifndef INPUTCONVERT_H
|
||||
#define INPUTCONVERT_H
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QWheelEvent>
|
||||
#include <QKeyEvent>
|
||||
#include "inputconvertbase.h"
|
||||
|
||||
#include "controlevent.h"
|
||||
|
||||
class InputConvert
|
||||
class InputConvert : public InputConvertBase
|
||||
{
|
||||
public:
|
||||
InputConvert();
|
||||
virtual ~InputConvert();
|
||||
|
||||
// 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
|
||||
static ControlEvent* mouseEvent(const QMouseEvent* from, const QSize& frameSize, const QSize& showSize);
|
||||
static ControlEvent* wheelEvent(const QWheelEvent* from, const QSize& frameSize, const QSize& showSize);
|
||||
static ControlEvent* keyEvent(const QKeyEvent* from);
|
||||
ControlEvent* mouseEvent(const QMouseEvent* from, const QSize& frameSize, const QSize& showSize);
|
||||
ControlEvent* wheelEvent(const QWheelEvent* from, const QSize& frameSize, const QSize& showSize);
|
||||
ControlEvent* keyEvent(const QKeyEvent* from);
|
||||
|
||||
private:
|
||||
static AndroidMotioneventButtons convertMouseButtons(Qt::MouseButtons buttonState);
|
||||
static AndroidKeycode convertKeyCode(int key, Qt::KeyboardModifiers modifiers);
|
||||
static AndroidMetastate convertMetastate(Qt::KeyboardModifiers modifiers);
|
||||
AndroidMotioneventButtons convertMouseButtons(Qt::MouseButtons buttonState);
|
||||
AndroidKeycode convertKeyCode(int key, Qt::KeyboardModifiers modifiers);
|
||||
AndroidMetastate convertMetastate(Qt::KeyboardModifiers modifiers);
|
||||
};
|
||||
|
||||
#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