aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qt/guiutil.h9
-rw-r--r--src/qt/rpcconsole.cpp4
2 files changed, 11 insertions, 2 deletions
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 211f3f506d..364962ee9a 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
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 6bcdcc4c29..1c19fb4b27 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -14,6 +14,7 @@
#include <netbase.h>
#include <qt/bantablemodel.h>
#include <qt/clientmodel.h>
+#include <qt/guiutil.h>
#include <qt/peertablesortproxy.h>
#include <qt/platformstyle.h>
#include <qt/walletmodel.h>
@@ -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();
}
}