summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.h
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2012-01-09 11:25:40 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-24 14:55:06 +0100
commit5a2efb490bc3549ef42420a0dafcf22072785e0d (patch)
tree5e0dc4396301e791fda198e9a11448532bc1aeec /src/gui/kernel/qevent.h
parente8952aba2914722b0ad0e6f07e2193ead7f2e39d (diff)
QWheelEvent high-resolution delta support.
Support pixel-based deltas as well as sending dx and dy values in the same event. Keep source and behavior compatibility with Qt 4. New API: QPoint pixelDelta() const QPoint angleDelta() const Deprecate delta() and orientation(). Both pixel-based deltas and combined updates are necessary for smooth trackpad-based scrolling on OS X. Qt 4 compatible behavior is achieved by sending an extra wheel event in cases where the initial event has a combined dx and dy update. This extra event sends dx in delta() and orientation(), with pixelDelta() and angleDelta() set to null. Modify the Cocoa implementation to provide pixel deltas. It is expected that not all platforms can provide these. Angle deltas will always be available. Change-Id: I20c10f0df338ddcd6a3f7a4d40949ed5ae3b4795 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r--src/gui/kernel/qevent.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 93dea41de9..ca93095a94 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -148,9 +148,21 @@ public:
QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient = Qt::Vertical);
+ QWheelEvent(const QPointF &pos, const QPointF& globalPos,
+ QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
+ Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
+
~QWheelEvent();
- inline int delta() const { return d; }
+
+ inline QPoint pixelDelta() const { return pixelD; }
+ inline QPoint angleDelta() const { return angleD; }
+
+#if QT_DEPRECATED_SINCE(5, 0)
+ inline QT_DEPRECATED int delta() const { return qt4D; }
+ inline QT_DEPRECATED Qt::Orientation orientation() const { return qt4O; }
+#endif
+
#ifndef QT_NO_INTEGER_EVENT_COORDINATES
inline QPoint pos() const { return p.toPoint(); }
inline QPoint globalPos() const { return g.toPoint(); }
@@ -163,15 +175,15 @@ public:
inline const QPointF &globalPosF() const { return g; }
inline Qt::MouseButtons buttons() const { return mouseState; }
- Qt::Orientation orientation() const { return o; }
-
-
protected:
QPointF p;
QPointF g;
- int d;
+ QPoint pixelD;
+ QPoint angleD;
+ int qt4D;
+ Qt::Orientation qt4O;
Qt::MouseButtons mouseState;
- Qt::Orientation o;
+ int reserved;
};
#endif