diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-08-06 11:12:35 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-08-19 15:16:43 +0200 |
commit | f3a64b13725081eb94b05dbeb5f68a2298c9163e (patch) | |
tree | 03a48c5f4e419b0f00c809bef399d7a03bdd56a3 /src | |
parent | 1a5a0a591c35dcf498a232a802087683f2244ecb (diff) |
SwipeDelegate: don't emit closed() when already closed
If the mouse is released while our position is 0, it means we were
clicked, and we don't need to begin any transitions to close.
Fixes: QTBUG-85806
Pick-to: 5.15
Change-Id: Ic521f48e2977c1a99dbecaa585792a7798b9d749
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquickswipedelegate.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp index a28d8ecf..3669ce05 100644 --- a/src/quicktemplates2/qquickswipedelegate.cpp +++ b/src/quicktemplates2/qquickswipedelegate.cpp @@ -889,7 +889,11 @@ bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *item, QMous swipePrivate->beginTransition(-1.0); swipePrivate->wasComplete = true; } else if (!swipePrivate->isTransitioning()) { - swipePrivate->beginTransition(0.0); + // The position is either <= 0.5 or >= -0.5, so the position should go to 0. + // However, if the position was already 0 or close to it, we were just clicked, + // and we don't need to start a transition. + if (!qFuzzyIsNull(swipePrivate->position)) + swipePrivate->beginTransition(0.0); swipePrivate->wasComplete = false; } |