diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:01:59 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:01:59 +0100 |
commit | d8c5dea96fb8861089e2166ae574a85d2b69c09e (patch) | |
tree | d3f01035541b10d98acbcde1321bc43de16096f6 /src/quicktemplates2/qquickswipedelegate.cpp | |
parent | 5efd4b6a61498f0668d7367d620275367894140e (diff) | |
parent | 838fd79152957f457a47cd30970961a27f086848 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
tests/auto/controls/data/tst_swipedelegate.qml
Change-Id: I15bd0366f1ad0ce35f1dce6d790da6dd5f0221f9
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 5430a4de..d4688867 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -737,6 +737,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 || |