diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-10-20 10:34:53 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-10-21 13:41:04 +0200 |
commit | a5e1c787f6512013a092f7708c6928b5a9e263c2 (patch) | |
tree | 2d0ca5b83001e815247bd97cb7bd0f421cf5cdf4 /src/quicktemplates2 | |
parent | 0ce5018f4b2c4386a89ba5d6a84fb14ea913b824 (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/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickabstractbutton.cpp | 2 |
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(); |