qt: Handle Android back key in the Node window #493

pull hebasto wants to merge 2 commits into bitcoin-core:master from hebasto:211201-back changing 2 files +11 −2
  1. hebasto commented at 9:55 pm on December 1, 2021: member

    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

  2. hebasto commented at 10:07 pm on December 1, 2021: member
    cc @icota
  3. hebasto added the label Android on Dec 1, 2021
  4. in src/qt/rpcconsole.cpp:914 in fe035a5fd9 outdated
    909@@ -910,8 +910,14 @@ void RPCConsole::clear(bool keep_prompt)
    910 
    911 void RPCConsole::keyPressEvent(QKeyEvent *event)
    912 {
    913-    if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape)
    914-    {
    915+    const auto close_key =
    916+#ifdef Q_OS_ANDROID
    


    icota commented at 11:41 am on December 2, 2021:
    I don’t like the #ifdef. Any way to remap this globally?

    hebasto commented at 11:45 am on December 2, 2021:
    @icota Could you elaborate? I’m not sure about Qt::Key_Back on non-Android platforms.

    icota commented at 11:58 am on December 2, 2021:

    One point is that this should be done globally rather than just in rpcconsole. In our case Qt::Key_Back and Qt::Key_Escape will always serve the same purpose.

    It also should not be an either-or because Android phones can have keyboards hooked up to them and ChromeOS can run APKs as well.

    I guess my suggestion would be something like a global macro/function that checks if its escape or back button. If this is truly the only place where we need to check for the back button then if (event->key == Qt::Key_Escape || event->key == Qt::Key_Back) is also cool.


    hebasto commented at 11:10 pm on December 2, 2021:
    Thanks! Implemented.
  5. icota changes_requested
  6. qt, android: Add GUIUtil::IsEscapeOrBack helper f045f98717
  7. qt: Handle Android back key in the Node window a56a104938
  8. hebasto force-pushed on Dec 2, 2021
  9. hebasto commented at 11:09 pm on December 2, 2021: member

    Updated fe035a5fd95944f8c654ee46ba3a4aae245560b3 -> a56a1049380b0acb532681484fbb675c3b2ff365 (pr493.01 -> pr493.02). @icota

    I guess my suggestion would be something like a global macro/function that checks if its escape or back button.

    Done.

    I didn’t find other cases when Android back button does not work as expected, but maybe I just missed them.

  10. hebasto added the label UX on Dec 2, 2021
  11. icota commented at 7:59 am on December 4, 2021: contributor
  12. hebasto merged this on Dec 5, 2021
  13. hebasto closed this on Dec 5, 2021

  14. hebasto deleted the branch on Dec 5, 2021
  15. sidhujag referenced this in commit fcbb41d8a7 on Dec 5, 2021
  16. RandyMcMillan referenced this in commit 72ca667d76 on Dec 23, 2021
  17. bitcoin-core locked this on Dec 5, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/gui. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-23 00:20 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me