diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-08-05 13:34:33 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-08 15:09:40 +0200 |
commit | 9dfe4b0e683d706400a2e929a8de97df64ca172e (patch) | |
tree | bbcd8ce3e6a9ffdffeef0be9a6e9d35dd7412e79 /src/gui/kernel/qevent.h | |
parent | d916ed12b3ce36fce04f107751423f9986be52f0 (diff) |
Introduce QWheelEvent::Phase (Begin, Changed, Ended)
Some platforms (read: OS X) send wheel events without delta to indicate
that scrolling is about to start or has ended. Currently, Qt simply
ignores wheel events that have no delta. This change introduces a new
QWheelEvent attribute that specifies the phase, and makes it possible
to receive the special wheel events in started/ended phases. These
events are required for implementing correctly behaving transient
scrollbars.
Change-Id: Ib8ce0d9ce9be63b2ad60aa7b0aaa1f12ef6cad09
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r-- | src/gui/kernel/qevent.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 7142450322..2de88cf010 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -167,6 +167,8 @@ protected: class Q_GUI_EXPORT QWheelEvent : public QInputEvent { public: + enum Phase { Started, Changed, Ended }; + QWheelEvent(const QPointF &pos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient = Qt::Vertical); @@ -176,6 +178,9 @@ public: QWheelEvent(const QPointF &pos, const QPointF& globalPos, QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); + QWheelEvent(const QPointF &pos, const QPointF& globalPos, + QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Phase phase); ~QWheelEvent(); @@ -198,6 +203,9 @@ public: inline const QPointF &globalPosF() const { return g; } inline Qt::MouseButtons buttons() const { return mouseState; } + + inline Phase phase() const { return Phase(ph); } + protected: QPointF p; QPointF g; @@ -206,7 +214,8 @@ protected: int qt4D; Qt::Orientation qt4O; Qt::MouseButtons mouseState; - int reserved; + uint ph : 2; + int reserved : 30; }; #endif |