[Qt] the RPC Console should be a QWidget to make window more independent #5258

pull jonasschnelli wants to merge 1 commits into bitcoin:master from jonasschnelli:rpcconsole-window changing 4 files +17 −11
  1. jonasschnelli commented at 3:42 PM on November 10, 2014: contributor

    fix issue #5254

  2. jonasschnelli force-pushed on Nov 10, 2014
  3. laanwj commented at 8:23 AM on November 11, 2014: member

    ACK on concept. Moving away from using QDialogs for widgets that are embedded into other windows makes sense.

    • After this you can no longer hide the debug window using <ESC>. IMO that was useful. That's why the following code was there, but I'm sure a similar thing can be done with QWidget.
    if(windowType() != Qt::Widget)
        QDialog::reject();
    
    • It doesn't solve #5254 here, I've tested on Ubuntu. This may be due to Ubuntu prefering this, as in other programs with multiple windows (like Gimp) the same happens (On the other hand in Firefox it is possible to have multiple windows open as well as minimize them separately, as there is no clear 'parent window'). Current behavior is:
      • Minimize debug window → debug window minimizes
      • Minimize main window → main window as well as debug window minimizes
  4. jonasschnelli commented at 8:33 AM on November 11, 2014: contributor

    @laanwj: Hmm... I just did some test on my ubuntu 14.04 VM.

    When i have both windows open, i click the "-" symbol at the top left of the main window and ONLY the main window does minimize.

    Screens:

    Both windows open, then press "-" at top left of main window bildschirmfoto 2014-11-11 um 09 30 04

    Results in: bildschirmfoto 2014-11-11 um 09 30 09

    ESC-Key: yes. I can bring back the esc key. I just thought because it's no longer a dialoge esc makes no more sense. But you right. It's kind a handy.

  5. laanwj commented at 8:36 AM on November 11, 2014: member

    Huh! Why do you get that. I tried exactly the same on Ubuntu 14.04 and get the behavior as described. Will do a rebuild from an empty tree.

  6. jonasschnelli commented at 8:42 AM on November 11, 2014: contributor

    If you have 3 buttons at the top left of your debug window (close, minimize, maximize) you should have built it right. If you have only two icons "close" / "maximize" you are still running a QDialog.

  7. laanwj commented at 8:43 AM on November 11, 2014: member

    It does work after making the debug window wholly independent

    -    rpcConsole = new RPCConsole(enableWallet ? this : 0);
    +    rpcConsole = new RPCConsole(0);
    
  8. jonasschnelli commented at 8:53 AM on November 11, 2014: contributor

    @laanwj against which qt version do you build? This maybe helps me to reproduce your issue.

  9. laanwj commented at 9:01 AM on November 11, 2014: member

    @jonasschnelli About Qt shows 5.2.1

    But anyhow - if your goal is to make the window independent, passing a parent window is counter-productive.

  10. jonasschnelli commented at 9:05 AM on November 11, 2014: contributor

    Okay. Now i see. Thanks. Let me change that and re-implement the ESC-key behavior.

  11. laanwj commented at 9:09 AM on November 11, 2014: member

    Making it an independent window does change some things:

    • The window has to be manually deleted in the destructor - this will no longer happen automatically
    • Initial positioning will be different, it will no longer appear in the middle of the main window as before. The shutdown window is another case of this; it cannot be a child window, but we still want to position it correctly, so maybe this code could be factored out to an utility function
        // Center shutdown window at where main window was
        const QPoint global = window->mapToGlobal(window->rect().center());
        shutdownWindow->move(global.x() - shutdownWindow->width() / 2, global.y() - shutdownWindow->height() / 2);
        shutdownWindow->show();
    
  12. jonasschnelli force-pushed on Nov 11, 2014
  13. in src/qt/rpcconsole.cpp:None in 231874e4b6 outdated
     199 | @@ -200,7 +200,7 @@ void RPCExecutor::request(const QString &command)
     200 |  }
     201 |  
     202 |  RPCConsole::RPCConsole(QWidget *parent) :
     203 | -    QDialog(parent),
     204 | +    QWidget(parent, Qt::Window),
    


    laanwj commented at 10:52 AM on November 11, 2014:

    This Qt:::Window is no longer necessary, it is automatic when parent==0.

  14. jonasschnelli force-pushed on Nov 11, 2014
  15. jonasschnelli force-pushed on Nov 11, 2014
  16. jonasschnelli force-pushed on Nov 11, 2014
  17. jonasschnelli commented at 12:42 PM on November 11, 2014: contributor

    @laanwj i did update some things. The app now only gets terminated when both windows are closed. Users can now keep the RPC window open when the main window is closed. ESC-Key implemented again.

    There are still a few issues where i could need some advice.

    1. Does it make sense to keep the RPCConsole open without the MainWindow?
    2. Currently the Menu disappears when the MainWindow get's closed
    3. How could the user reopen the MainWindow when closed once? (TryIcon?)
    4. When reopening the MainWindow, the Menu comes back but the menu-titile says "DebugWindow".
  18. laanwj commented at 12:50 PM on November 11, 2014: member

    Closing the main window should exit the application, IMO. Let's not make this too complicated. Minimizing the windows individually is enough.

  19. jonasschnelli commented at 1:12 PM on November 11, 2014: contributor

    Agreed. This will simplify things for me a lot. :)

  20. jonasschnelli force-pushed on Nov 11, 2014
  21. jonasschnelli force-pushed on Nov 11, 2014
  22. jonasschnelli commented at 1:29 PM on November 11, 2014: contributor

    @laanwj: updated again.

    1. rpcConsole instance variable get's deleted now, destructor/store geometry gets called again.
    2. MainWindow close events terminate app as it was before.

    positioning:

        RPCConsole::~RPCConsole()
        {
            GUIUtil::saveWindowGeometry("nRPCConsoleWindow", this);
    

    isn't it so, that the position is managed by the GUIUtil? Or do you think the initial position must be set if no previous geometry was stored?

  23. jonasschnelli force-pushed on Nov 11, 2014
  24. laanwj commented at 3:50 PM on November 12, 2014: member

    isn't it so, that the position is managed by the GUIUtil?

    You'd say so, but I noticed a difference in positioning when I tested your code. I don't personally care that much if it's centered, though, although in my case it ended up on the other side of my other desktop.

  25. jonasschnelli commented at 4:06 PM on November 12, 2014: contributor

    @laanwj I think your last test wasn't with the change where the RPCConsole gets properly deleted in the destructor. Without that the position wasn't stored.

  26. in src/qt/rpcconsole.cpp:None in dfc05ccf92 outdated
     370 | +void RPCConsole::keyPressEvent(QKeyEvent *event)
     371 |  {
     372 | -    // Ignore escape keypress if this is not a seperate window
     373 | -    if(windowType() != Qt::Widget)
     374 | -        QDialog::reject();
     375 | +    if(event->key() == Qt::Key_Escape)
    


    laanwj commented at 11:30 AM on November 13, 2014:

    Please keep the windowType() != Qt::Widget. Pressing escape in disablewallet mode now deletes the interface.

  27. laanwj commented at 11:30 AM on November 13, 2014: member

    ACK apart from above nit (tested with wallet mode, disablewallet mode, and compiled without wallet support).

  28. laanwj commented at 11:35 AM on November 13, 2014: member

    @rebroad can you confirm that this fixes #5254?

  29. [Qt] the RPC Console should be a QWidget to make window more independent
    - fix issue #5254
    4a8fc152a9
  30. jonasschnelli force-pushed on Nov 13, 2014
  31. laanwj added the label GUI on Nov 18, 2014
  32. jonasschnelli commented at 12:12 PM on November 26, 2014: contributor

    ping @rebroad

  33. laanwj merged this on Dec 16, 2014
  34. laanwj closed this on Dec 16, 2014

  35. laanwj referenced this in commit 73cbf0a527 on Dec 16, 2014
  36. 0xartem referenced this in commit 9e19671e3b on Jun 1, 2018
  37. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:15 UTC

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