1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

converted invokables to properties in qml events

This commit is contained in:
Anmol Gautam 2018-06-30 01:50:08 +05:30
parent 8339ac9278
commit 18ebbc2ade
3 changed files with 68 additions and 34 deletions

View File

@ -23,16 +23,24 @@
class QmlKeyEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(int count READ count CONSTANT)
Q_PROPERTY(bool autoRepeat READ isAutoRepeat CONSTANT)
Q_PROPERTY(int key READ key CONSTANT)
Q_PROPERTY(int modifiers READ modifiers CONSTANT)
Q_PROPERTY(quint32 nativeModifiers READ nativeModifiers CONSTANT)
Q_PROPERTY(quint32 nativeScanCode READ nativeScanCode CONSTANT)
Q_PROPERTY(quint32 nativeVirtualKey READ nativeVirtualKey CONSTANT)
Q_PROPERTY(QString text READ text CONSTANT)
public:
explicit QmlKeyEvent(QKeyEvent *keyEvent = nullptr, QObject *parent = nullptr);
Q_INVOKABLE int count() const;
Q_INVOKABLE bool isAutoRepeat() const;
Q_INVOKABLE int key() const;
Q_INVOKABLE int modifiers() const;
Q_INVOKABLE quint32 nativeModifiers() const;
Q_INVOKABLE quint32 nativeScanCode() const;
Q_INVOKABLE quint32 nativeVirtualKey() const;
Q_INVOKABLE QString text() const;
int count() const;
bool isAutoRepeat() const;
int key() const;
int modifiers() const;
quint32 nativeModifiers() const;
quint32 nativeScanCode() const;
quint32 nativeVirtualKey() const;
QString text() const;
private:
QKeyEvent *m_keyEvent;

View File

@ -22,20 +22,32 @@
class QmlMouseEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(int button READ button CONSTANT)
Q_PROPERTY(int buttons READ buttons CONSTANT)
Q_PROPERTY(QPoint globalPos READ globalPos CONSTANT)
Q_PROPERTY(int globalX READ globalX CONSTANT)
Q_PROPERTY(int globalY READ globalY CONSTANT)
Q_PROPERTY(QPointF localPos READ localPos CONSTANT)
Q_PROPERTY(QPoint pos READ pos CONSTANT)
Q_PROPERTY(QPointF screenPos READ screenPos CONSTANT)
Q_PROPERTY(int source READ source CONSTANT)
Q_PROPERTY(QPointF windowPos READ windowPos CONSTANT)
Q_PROPERTY(int x READ x CONSTANT)
Q_PROPERTY(int y READ y CONSTANT)
public:
explicit QmlMouseEvent(QMouseEvent *mouseEvent = nullptr, QObject *parent = nullptr);
Q_INVOKABLE int button() const;
Q_INVOKABLE int buttons() const;
Q_INVOKABLE QPoint globalPos() const;
Q_INVOKABLE int globalX() const;
Q_INVOKABLE int globalY() const;
Q_INVOKABLE QPointF localPos() const;
Q_INVOKABLE QPoint pos() const;
Q_INVOKABLE QPointF screenPos() const;
Q_INVOKABLE int source() const;
Q_INVOKABLE QPointF windowPos() const;
Q_INVOKABLE int x() const;
Q_INVOKABLE int y() const;
int button() const;
int buttons() const;
QPoint globalPos() const;
int globalX() const;
int globalY() const;
QPointF localPos() const;
QPoint pos() const;
QPointF screenPos() const;
int source() const;
QPointF windowPos() const;
int x() const;
int y() const;
private:
QMouseEvent *m_mouseEvent;

View File

@ -23,22 +23,36 @@
class QmlWheelEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(QPoint angleDelta READ angleDelta CONSTANT)
Q_PROPERTY(int buttons READ buttons CONSTANT)
Q_PROPERTY(QPoint globalPos READ globalPos CONSTANT)
Q_PROPERTY(QPointF globalPosF READ globalPosF CONSTANT)
Q_PROPERTY(int globalX READ globalX CONSTANT)
Q_PROPERTY(int globalY READ globalY CONSTANT)
Q_PROPERTY(bool inverted READ inverted CONSTANT)
Q_PROPERTY(int phase READ phase CONSTANT)
Q_PROPERTY(QPoint pixelDelta READ pixelDelta CONSTANT)
Q_PROPERTY(QPoint pos READ pos CONSTANT)
Q_PROPERTY(QPointF posF READ posF CONSTANT)
Q_PROPERTY(int source READ source CONSTANT)
Q_PROPERTY(int x READ x CONSTANT)
Q_PROPERTY(int y READ y CONSTANT)
public:
explicit QmlWheelEvent(QWheelEvent *wheelEvent = nullptr, QObject *parent = nullptr);
Q_INVOKABLE QPoint angleDelta() const;
Q_INVOKABLE int buttons() const;
Q_INVOKABLE QPoint globalPos() const;
Q_INVOKABLE QPointF globalPosF() const;
Q_INVOKABLE int globalX() const;
Q_INVOKABLE int globalY() const;
Q_INVOKABLE bool inverted() const;
Q_INVOKABLE int phase() const;
Q_INVOKABLE QPoint pixelDelta() const;
Q_INVOKABLE QPoint pos() const;
Q_INVOKABLE QPointF posF() const;
Q_INVOKABLE int source() const;
Q_INVOKABLE int x() const;
Q_INVOKABLE int y() const;
QPoint angleDelta() const;
int buttons() const;
QPoint globalPos() const;
QPointF globalPosF() const;
int globalX() const;
int globalY() const;
bool inverted() const;
int phase() const;
QPoint pixelDelta() const;
QPoint pos() const;
QPointF posF() const;
int source() const;
int x() const;
int y() const;
private:
QWheelEvent *m_wheelEvent;
};