From 317c341a66328f1ac4fdf302b009f8bb5002799d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 28 Jan 2015 18:26:41 +0100 Subject: [PATCH] QWheelEvent on OSX: phase changes to ScrollEnd after momentum phase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The phase changes to ScrollEnd as soon as the user's fingers are lifted from the trackpad; then the OS can optionally continue sending scroll events to simulate deceleration, which are translated into more QWheelEvents with phase ScrollUpdate. With this patch, the phase of the final event after the momentum phase will be ScrollEnd to indicate that the scrolling is completely finished. [ChangeLog][QtGui][QWheelEvent] on OSX, trackpad wheel event phase transitions occur in the order ScrollBegin, ScrollUpdate, ..., ScrollEnd, ScrollUpdate, ..., ScrollEnd, where the second batch of updates represent momentum events (inertial scrolling). Change-Id: I7404ed6fbbeaff6b1fa63e226fe1800494986b7b Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index d7e1a571660..e2da8722a32 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1326,7 +1326,8 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) if (!m_scrolling) ph = Qt::ScrollBegin; m_scrolling = true; - } else if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled) { + } else if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled || + momentumPhase == NSEventPhaseEnded || momentumPhase == NSEventPhaseCancelled) { ph = Qt::ScrollEnd; m_scrolling = false; }