aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-12-05 02:35:51 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-12-05 02:45:13 +0200
commitea989deecc8d4d02bb401c0ac7cd7a0543e3454c (patch)
tree7114eac3e92e974cf6b43c31706fa38ba3de51e5
parent57982f419e36d0023c83af2dd0d683ca3160dc2a (diff)
parenta56a1049380b0acb532681484fbb675c3b2ff365 (diff)
downloadbitcoin-ea989deecc8d4d02bb401c0ac7cd7a0543e3454c.tar.xz
Merge bitcoin-core/gui#493: qt: Handle Android back key in the Node window
a56a1049380b0acb532681484fbb675c3b2ff365 qt: Handle Android back key in the Node window (Hennadii Stepanov) f045f987171c3960c12813538b9f19a54a50b4f8 qt, android: Add GUIUtil::IsEscapeOrBack helper (Hennadii Stepanov) Pull request description: On master (4633199cc8a466b8a2cfa14ba9d7793dd4c469f4) there are no means to return from the Node window to the main one on Android. This PR assigns this functionality to the Android back key: ![Screenshot_1638395318](https://user-images.githubusercontent.com/32963518/144320316-af5599ac-0379-40e6-9887-7f5ee30b97ae.png) ACKs for top commit: icota: utACK https://github.com/bitcoin-core/gui/commit/a56a1049380b0acb532681484fbb675c3b2ff365 Tree-SHA512: 379c1ad8c6bffa037e861b88c66eb33872d7f7d54aa2f76289a51c55d79a37a0c16262b20f22d00fda11522c7df1f3561c1ceae34cd7a85da94aee4c6cdcfaaf
-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();
}
}