aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2020-10-20 10:34:53 +0200
committerMitch Curtis <mitch.curtis@qt.io>2020-10-21 13:41:04 +0200
commita5e1c787f6512013a092f7708c6928b5a9e263c2 (patch)
tree2d0ca5b83001e815247bd97cb7bd0f421cf5cdf4 /src
parent0ce5018f4b2c4386a89ba5d6a84fb14ea913b824 (diff)
QQuickAbstractButton: don't accept key release if we're not pressed
A control should have been pressed if it's going to accept a release. This prevents an issue where a menu opened by pressing enter (handled via attached Keys property) would instantly trigger the first menu item. Pick-to: 5.15 5.12 Fixes: QTBUG-83698 Change-Id: I6b1afbb76f37623012472b2b1148b4862c159239 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index e7809e8f..79a94cc1 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -1072,7 +1072,7 @@ void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QQuickAbstractButton);
QQuickControl::keyReleaseEvent(event);
- if (d->acceptKeyClick(static_cast<Qt::Key>(event->key()))) {
+ if (d->pressed && d->acceptKeyClick(static_cast<Qt::Key>(event->key()))) {
setPressed(false);
nextCheckState();