From c0556d92f3415b478da4aff24f6f5545df394983 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 11 Aug 2014 16:06:47 +0200 Subject: [PATCH] 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 --- src/gui/kernel/qguiapplication.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 831ebd19c0..9155abf8b9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -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