fix issue #5254
[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-
jonasschnelli commented at 3:42 PM on November 10, 2014: contributor
- jonasschnelli force-pushed on Nov 10, 2014
-
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
- After this you can no longer hide the debug window using
-
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

Results in:

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.
-
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.
-
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.
-
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); -
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.
-
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.
-
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.
-
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(); - jonasschnelli force-pushed on Nov 11, 2014
-
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.
jonasschnelli force-pushed on Nov 11, 2014jonasschnelli force-pushed on Nov 11, 2014jonasschnelli force-pushed on Nov 11, 2014jonasschnelli 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.
- Does it make sense to keep the RPCConsole open without the MainWindow?
- Currently the Menu disappears when the MainWindow get's closed
- How could the user reopen the MainWindow when closed once? (TryIcon?)
- When reopening the MainWindow, the Menu comes back but the menu-titile says "DebugWindow".
laanwj commented at 12:50 PM on November 11, 2014: memberClosing the main window should exit the application, IMO. Let's not make this too complicated. Minimizing the windows individually is enough.
jonasschnelli commented at 1:12 PM on November 11, 2014: contributorAgreed. This will simplify things for me a lot. :)
jonasschnelli force-pushed on Nov 11, 2014jonasschnelli force-pushed on Nov 11, 2014jonasschnelli commented at 1:29 PM on November 11, 2014: contributor@laanwj: updated again.
- rpcConsole instance variable get's deleted now, destructor/store geometry gets called again.
- 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?
jonasschnelli force-pushed on Nov 11, 2014laanwj commented at 3:50 PM on November 12, 2014: memberisn'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.
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.
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.laanwj commented at 11:30 AM on November 13, 2014: memberACK apart from above nit (tested with wallet mode, disablewallet mode, and compiled without wallet support).
4a8fc152a9[Qt] the RPC Console should be a QWidget to make window more independent
- fix issue #5254
jonasschnelli force-pushed on Nov 13, 2014laanwj added the label GUI on Nov 18, 2014jonasschnelli commented at 12:12 PM on November 26, 2014: contributorping @rebroad
laanwj merged this on Dec 16, 2014laanwj closed this on Dec 16, 2014laanwj referenced this in commit 73cbf0a527 on Dec 16, 20140xartem referenced this in commit 9e19671e3b on Jun 1, 2018MarcoFalke locked this on Sep 8, 2021ContributorsLabels
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
More mirrored repositories can be found on mirror.b10c.me