From f045f987171c3960c12813538b9f19a54a50b4f8 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 3 Dec 2021 01:02:10 +0200 Subject: [PATCH 1/2] qt, android: Add GUIUtil::IsEscapeOrBack helper --- src/qt/guiutil.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 211f3f506d5..364962ee9a7 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -428,6 +428,15 @@ namespace GUIUtil */ void ShowModalDialogAndDeleteOnClose(QDialog* dialog); + inline bool IsEscapeOrBack(int key) + { + if (key == Qt::Key_Escape) return true; +#ifdef Q_OS_ANDROID + if (key == Qt::Key_Back) return true; +#endif // Q_OS_ANDROID + return false; + } + } // namespace GUIUtil #endif // BITCOIN_QT_GUIUTIL_H From a56a1049380b0acb532681484fbb675c3b2ff365 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Fri, 3 Dec 2021 01:03:11 +0200 Subject: [PATCH 2/2] qt: Handle Android back key in the Node window --- src/qt/rpcconsole.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 6bcdcc4c29f..1c19fb4b274 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -910,8 +911,7 @@ void RPCConsole::clear(bool keep_prompt) void RPCConsole::keyPressEvent(QKeyEvent *event) { - if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape) - { + if (windowType() != Qt::Widget && GUIUtil::IsEscapeOrBack(event->key())) { close(); } }