aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorNikita Krupenko <krnekit@gmail.com>2016-05-18 06:47:36 +0300
committerNikita Krupenko <krnekit@gmail.com>2016-05-18 13:59:24 +0000
commit8f08885f8557099c2a37d4f3579e73f900a43cad (patch)
treed5a67c53b5f3336b22f605b4f56bd0f1aa30d479 /src/quicktemplates2
parent145ba3fd216b1d77331ef239f957360e03432d44 (diff)
Popup: don't ignore Back key
This allows to close popup on mobile device when Back key pressed and CloseOnEscape policy is set. Change-Id: I97e863b462ee50d2d8e79d18cf8097f960f14227 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp2
-rw-r--r--src/quicktemplates2/qquickpopup.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index cf64ae95..c41265a4 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -781,6 +781,7 @@ void QQuickComboBox::keyPressEvent(QKeyEvent *event)
switch (event->key()) {
case Qt::Key_Escape:
+ case Qt::Key_Back:
if (d->isPopupVisible())
event->accept();
break;
@@ -828,6 +829,7 @@ void QQuickComboBox::keyReleaseEvent(QKeyEvent *event)
event->accept();
break;
case Qt::Key_Escape:
+ case Qt::Key_Back:
d->hidePopup(false);
setPressed(false);
event->accept();
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 6d969e30..9279b261 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -1831,7 +1831,7 @@ void QQuickPopup::keyPressEvent(QKeyEvent *event)
if (hasActiveFocus() && (event->key() == Qt::Key_Tab || event->key() == Qt::Key_Backtab))
QQuickItemPrivate::focusNextPrev(d->popupItem, event->key() == Qt::Key_Tab);
- if (event->key() != Qt::Key_Escape)
+ if (event->key() != Qt::Key_Escape && event->key() != Qt::Key_Back)
return;
if (d->closePolicy.testFlag(CloseOnEscape))