diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-04-23 14:05:25 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-04-25 11:50:41 +0000 |
commit | bc93333958e469e2bd79319befb23328a9de38a9 (patch) | |
tree | fcc31b6137ca20da1fc5a26f0f459d59c785c6b5 /src | |
parent | 110b7187cef4a920423e860ef0e10f819c283fa2 (diff) |
ComboBox: don't block the escape/back key (with fixed test)
Accept Key_Escape or Key_Back only if it actually close the popup. If
the popup is not visible, the key is not handled, and the event should
therefore propagate (and potentially close the app on Android).
Note: def92f7 had a broken test (didn't take the popup exit transition
into account) and thus, blocked the CI and got rejected in 110b718.
Task-number: QTBUG-67684
Change-Id: I46b4731b3006721f3737cf909fbd97331ac6d8ed
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index d3226baf..4d5efece 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -1624,9 +1624,11 @@ void QQuickComboBox::keyReleaseEvent(QKeyEvent *event) break; case Qt::Key_Escape: case Qt::Key_Back: - d->hidePopup(false); - setPressed(false); - event->accept(); + if (d->isPopupVisible()) { + d->hidePopup(false); + setPressed(false); + event->accept(); + } break; default: break; |