diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:59:53 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:59:53 +0100 |
commit | 4ba00f0054ffd183377fd420b35ef7a388c0bcfe (patch) | |
tree | dde076314b40ce0dd540e5363ff6d9fca98016f4 /src/quicktemplates2/qquickswipedelegate.cpp | |
parent | 948932c9c6ae535647e69962aad2add516802b9c (diff) | |
parent | d8c5dea96fb8861089e2166ae574a85d2b69c09e (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/imports/controls/SpinBox.qml
src/imports/controls/material/SpinBox.qml
src/imports/controls/universal/SpinBox.qml
tests/auto/controls/data/tst_swipedelegate.qml
Change-Id: Ie1d1f487890f0a9f80a00df5e813e1d2e8303fe5
Diffstat (limited to 'src/quicktemplates2/qquickswipedelegate.cpp')
-rw-r--r-- | src/quicktemplates2/qquickswipedelegate.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp index e660cfa2..2f7e7382 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -775,6 +775,21 @@ bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *item, QMous const bool hadGrabbedMouse = q->keepMouseGrab(); q->setKeepMouseGrab(false); + // Animations for the background and contentItem delegates are typically + // only enabled when !control.down, so that the animations aren't running + // when the user is swiping. To ensure that the animations are enabled + // *before* the positions of these delegates change (via the swipe.setPosition() calls below), + // we must cancel the press. QQuickAbstractButton::mouseUngrabEvent() does this + // for us, but by then it's too late. + if (hadGrabbedMouse) { + // TODO: this is copied from QQuickAbstractButton::mouseUngrabEvent(). + // Eventually it should be moved into a private helper so that we don't have to duplicate it. + q->setPressed(false); + stopPressRepeat(); + stopPressAndHold(); + emit q->canceled(); + } + // The control can be exposed by either swiping past the halfway mark, or swiping fast enough. const qreal swipeVelocity = swipePrivate->velocityCalculator.velocity().x(); if (swipePrivate->position > 0.5 || |