0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

Merge bitcoin-core/gui#493: qt: Handle Android back key in the Node window

a56a104938 qt: Handle Android back key in the Node window (Hennadii Stepanov)
f045f98717 qt, android: Add GUIUtil::IsEscapeOrBack helper (Hennadii Stepanov)

Pull request description:

  On master (4633199cc8) 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 a56a104938

Tree-SHA512: 379c1ad8c6bffa037e861b88c66eb33872d7f7d54aa2f76289a51c55d79a37a0c16262b20f22d00fda11522c7df1f3561c1ceae34cd7a85da94aee4c6cdcfaaf
This commit is contained in:
Hennadii Stepanov 2021-12-05 02:35:51 +02:00
commit ea989deecc
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
2 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -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();
}
}