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-22 12:10:56 +0200 |
commit | 1a3d27b017fae0471a82870b28e1e808bc2aac33 (patch) | |
tree | 3c1dd33b80abb902e61d294d3628c4bdb17a8ccb /src | |
parent | a1b0f708e6a22297bdd8af2cf8c461de5da7a16e (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.
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>
(cherry picked from commit a5e1c787f6512013a092f7708c6928b5a9e263c2)
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-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 c0e1cb8e..fc37b6f6 100644 --- a/src/quicktemplates2/qquickabstractbutton.cpp +++ b/src/quicktemplates2/qquickabstractbutton.cpp @@ -1064,7 +1064,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(); |