diff options
author | Nils Jeisecke <nils.jeisecke@saltation.com> | 2018-04-04 13:23:00 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-04-06 17:32:51 +0000 |
commit | d868bb4f3e4b0424fd4a2989ff1c82692b0f014c (patch) | |
tree | 7b725f820e287f1ce4d98c2bbb565ca6ef48c610 /src/quick | |
parent | d7ada80e5c134a0d1a13539a46e378b7ea6dcf6d (diff) |
Fix Flickable mouse wheel handling on macOS
On macOS a special movementEnding timer was added to the wheelEvent
handling to fix QTBUG-63026.
This has introduced a regression with wrong vData/hData.moving flags:
When the timer fires before the Qt::ScrollEnd phase is reached,
movementEnding is invoked early (can be reproduced with very slow scrolling
using the Magic Mouse). In this case movementEnding sets
vData.moving = false but not vMoved = false because scrollingPhase is
still true.
This will prevent any further invocation of movementStarting from inside
the drag method (it expects a change in vMoved) so once this situation
has occurred the "moving" flags will be out of sync.
Visible effect: If a ListView has a currentItem set with
setCurrentIndex, its viewportMoved method will no longer correctly set
the moveReason to "Mouse" because the check depends on "moving" flag as
an indicator for mouse interaction. This results in the view permanently
jumping back to the current item on any scroll operation because the
moveReason will be stuck at "SetIndex".
The fix is to ignore the timer event if scrollingPhase is still true.
Task-number: QTBUG-67460
Change-Id: I7cf02b8c625b7baf249ad26c4e0c3df874a18eae
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 8cb64377cc..9c775f7e93 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1649,10 +1649,12 @@ void QQuickFlickable::timerEvent(QTimerEvent *event) } } else if (event->timerId() == d->movementEndingTimer.timerId()) { d->movementEndingTimer.stop(); - d->pressed = false; - d->stealMouse = false; - if (!d->velocityTimeline.isActive() && !d->timeline.isActive()) - movementEnding(true, true); + if (!d->scrollingPhase) { + d->pressed = false; + d->stealMouse = false; + if (!d->velocityTimeline.isActive() && !d->timeline.isActive()) + movementEnding(true, true); + } } } |