Skip to content

Commit ea989de

Browse files
committed
Merge #493: qt: Handle Android back key in the Node window
a56a104 qt: Handle Android back key in the Node window (Hennadii Stepanov) f045f98 qt, android: Add GUIUtil::IsEscapeOrBack helper (Hennadii Stepanov) Pull request description: On master (4633199) 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 a56a104 Tree-SHA512: 379c1ad8c6bffa037e861b88c66eb33872d7f7d54aa2f76289a51c55d79a37a0c16262b20f22d00fda11522c7df1f3561c1ceae34cd7a85da94aee4c6cdcfaaf
2 parents 57982f4 + a56a104 commit ea989de

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/qt/guiutil.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,15 @@ namespace GUIUtil
428428
*/
429429
void ShowModalDialogAndDeleteOnClose(QDialog* dialog);
430430

431+
inline bool IsEscapeOrBack(int key)
432+
{
433+
if (key == Qt::Key_Escape) return true;
434+
#ifdef Q_OS_ANDROID
435+
if (key == Qt::Key_Back) return true;
436+
#endif // Q_OS_ANDROID
437+
return false;
438+
}
439+
431440
} // namespace GUIUtil
432441

433442
#endif // BITCOIN_QT_GUIUTIL_H

src/qt/rpcconsole.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <netbase.h>
1515
#include <qt/bantablemodel.h>
1616
#include <qt/clientmodel.h>
17+
#include <qt/guiutil.h>
1718
#include <qt/peertablesortproxy.h>
1819
#include <qt/platformstyle.h>
1920
#include <qt/walletmodel.h>
@@ -910,8 +911,7 @@ void RPCConsole::clear(bool keep_prompt)
910911

911912
void RPCConsole::keyPressEvent(QKeyEvent *event)
912913
{
913-
if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape)
914-
{
914+
if (windowType() != Qt::Widget && GUIUtil::IsEscapeOrBack(event->key())) {
915915
close();
916916
}
917917
}

0 commit comments

Comments
 (0)