Android: don't kill the app without warning

If the back key was pressed when no window was
visible, such as during startup, the app would be
killed without notice. This change makes sure that
we always give the app a chance to intercept the
back key before killing the application.

[ChangeLog][Android] Back key no longer kills the application
when no window is visible.

Task-number: QTBUG-39688
Change-Id: If9373e8d26ff323d8c8a274fb30820ecc4ca66ab
Reviewed-by: BogDan Vatra <bogdan@kde.org>
This commit is contained in:
Paul Olav Tvete 2014-08-11 16:06:47 +02:00
parent 4e6ebabb30
commit c0556d92f3

View File

@ -1889,9 +1889,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
if (e->keyType == QEvent::KeyPress) {
backKeyPressAccepted = e->key == Qt::Key_Back && ev.isAccepted();
} else if (e->keyType == QEvent::KeyRelease && e->key == Qt::Key_Back && !backKeyPressAccepted && !ev.isAccepted()) {
if (!window)
qApp->quit();
else
if (window)
QWindowSystemInterface::handleCloseEvent(window);
}
#endif