summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-03-01 13:17:13 +0100
committerShawn Rutledge <shawn.rutledge@theqtcompany.com>2016-03-05 10:48:12 +0000
commitd5fde514106f5479f9c929c8a165aced4a1b2c84 (patch)
treec16ad67adad2eb4f5cfffe3a9374aafbdd1c1d32 /src/gui/kernel/qevent.cpp
parent362b977e7c99d47c9c598cef946273089881fd81 (diff)
QWheelEvent: make NoScrollPhase opt-in
The fix for QTBUG-50199 involves adding an undocumented enum value which can be returned from QWheelEvent::phase(). This will be quite unexpected for applications that use it, which work fine with 5.6.0 and then start receiving this new phase value in 5.6.1. So it should not happen by default. Set the env variable QT_ENABLE_MOUSE_WHEEL_TRACKING to enable this functionality. In 5.7 it will be default behavior. But in 5.6 the default behavior is as it was before: if you use a conventional mouse wheel, the phase stays at ScrollUpdate continuously. [ChangeLog][QtCore] QWheelEvent::phase() returns 0 rather than Qt::ScrollUpdate when the wheel event comes from an actual non-emulated mouse wheel and the environment variable QT_ENABLE_MOUSE_WHEEL_TRACKING is set. In Qt 5.6, this is required to enable the fix for QTBUG-50199. Change-Id: Ieb2152ff767df24c42730d201235d1225aaec832 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/gui/kernel/qevent.cpp')
-rw-r--r--src/gui/kernel/qevent.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 8abec2b05e..9281744692 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -729,6 +729,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
: QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons),
ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized)
{
+ if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
+ ph = Qt::ScrollUpdate;
g = QCursor::pos();
if (orient == Qt::Vertical)
angleD = QPoint(0, delta);
@@ -764,6 +766,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons),
ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized)
{
+ if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
+ ph = Qt::ScrollUpdate;
if (orient == Qt::Vertical)
angleD = QPoint(0, delta);
else
@@ -800,7 +804,10 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase),
src(Qt::MouseEventNotSynthesized)
-{}
+{
+ if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
+ ph = Qt::ScrollUpdate;
+}
/*!
Constructs a wheel event object.