aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickevents_p_p.h
diff options
context:
space:
mode:
authorLuis Gabriel Lima <luis.gabriel@openbossa.org>2012-01-05 15:19:26 -0300
committerQt by Nokia <qt-info@nokia.com>2012-03-10 02:28:11 +0100
commitf2e1be963f885a6030136591414cdbda26d50695 (patch)
tree3ff02cedfbf5df61e8459dc6d58afd437b23e87b /src/quick/items/qquickevents_p_p.h
parent78356f6038065227acb2dc898994765f49f07b42 (diff)
Add mouse wheel events handler to MouseArea
This patch was based on the attached patch in QTBUG-7369. It basically exposes the wheel events to MouseArea via the onWheel signal. The current API is based on the new QWheelEvent API introduced by this patch: http://codereview.qt-project.org/#change,12532 Task-number: QTBUG-7369 Change-Id: Id58513715c2d0ae81e3a69e9e1ed400bbae07507 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/quick/items/qquickevents_p_p.h')
-rw-r--r--src/quick/items/qquickevents_p_p.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 6300b0f2a7..004daafb04 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -201,9 +201,47 @@ private:
};
+class QQuickWheelEvent : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x)
+ Q_PROPERTY(qreal y READ y)
+ Q_PROPERTY(QPoint angleDelta READ angleDelta)
+ Q_PROPERTY(QPoint pixelDelta READ pixelDelta)
+ Q_PROPERTY(int buttons READ buttons)
+ Q_PROPERTY(int modifiers READ modifiers)
+ Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
+
+public:
+ QQuickWheelEvent(qreal x, qreal y, const QPoint& angleDelta, const QPoint& pixelDelta,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
+ : _x(x), _y(y), _angleDelta(angleDelta), _pixelDelta(pixelDelta), _buttons(buttons),
+ _modifiers(modifiers), _accepted(true) {}
+
+ qreal x() const { return _x; }
+ qreal y() const { return _y; }
+ QPoint angleDelta() const { return _angleDelta; }
+ QPoint pixelDelta() const { return _pixelDelta; }
+ int buttons() const { return _buttons; }
+ int modifiers() const { return _modifiers; }
+
+ bool isAccepted() { return _accepted; }
+ void setAccepted(bool accepted) { _accepted = accepted; }
+
+private:
+ qreal _x;
+ qreal _y;
+ QPoint _angleDelta;
+ QPoint _pixelDelta;
+ Qt::MouseButtons _buttons;
+ Qt::KeyboardModifiers _modifiers;
+ bool _accepted;
+};
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickKeyEvent)
QML_DECLARE_TYPE(QQuickMouseEvent)
+QML_DECLARE_TYPE(QQuickWheelEvent)
#endif // QQUICKEVENTS_P_P_H