@@ -400,16 +400,18 @@ void BitcoinGUI::createMenuBar()
400
400
401
401
QMenu* window_menu = appMenuBar->addMenu (tr (" &Window" ));
402
402
403
- QAction* minimize_action = window_menu->addAction (tr (" Minimize" ), [] {
403
+ QAction* minimize_action = window_menu->addAction (tr (" Minimize" ));
404
+ minimize_action->setShortcut (QKeySequence (Qt::CTRL + Qt::Key_M));
405
+ connect (minimize_action, &QAction::triggered, [] {
404
406
qApp->focusWindow ()->showMinimized ();
405
- }, QKeySequence (Qt::CTRL + Qt::Key_M));
406
-
407
+ });
407
408
connect (qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
408
409
minimize_action->setEnabled (window != nullptr && (window->flags () & Qt::Dialog) != Qt::Dialog && window->windowState () != Qt::WindowMinimized);
409
410
});
410
411
411
412
#ifdef Q_OS_MAC
412
- QAction* zoom_action = window_menu->addAction (tr (" Zoom" ), [] {
413
+ QAction* zoom_action = window_menu->addAction (tr (" Zoom" ));
414
+ connect (zoom_action, &QAction::triggered, [] {
413
415
QWindow* window = qApp->focusWindow ();
414
416
if (window->windowState () != Qt::WindowMaximized) {
415
417
window->showMaximized ();
@@ -422,7 +424,8 @@ void BitcoinGUI::createMenuBar()
422
424
zoom_action->setEnabled (window != nullptr );
423
425
});
424
426
#else
425
- QAction* restore_action = window_menu->addAction (tr (" Restore" ), [] {
427
+ QAction* restore_action = window_menu->addAction (tr (" Restore" ));
428
+ connect (restore_action, &QAction::triggered, [] {
426
429
qApp->focusWindow ()->showNormal ();
427
430
});
428
431
@@ -433,7 +436,8 @@ void BitcoinGUI::createMenuBar()
433
436
434
437
if (walletFrame) {
435
438
window_menu->addSeparator ();
436
- window_menu->addAction (tr (" Main Window" ), [this ] {
439
+ QAction* main_window_action = window_menu->addAction (tr (" Main Window" ));
440
+ connect (main_window_action, &QAction::triggered, [this ] {
437
441
GUIUtil::bringToFront (this );
438
442
});
439
443
@@ -444,7 +448,8 @@ void BitcoinGUI::createMenuBar()
444
448
445
449
window_menu->addSeparator ();
446
450
for (RPCConsole::TabTypes tab_type : rpcConsole->tabs ()) {
447
- window_menu->addAction (rpcConsole->tabTitle (tab_type), [this , tab_type] {
451
+ QAction* tab_action = window_menu->addAction (rpcConsole->tabTitle (tab_type));
452
+ connect (tab_action, &QAction::triggered, [this , tab_type] {
448
453
rpcConsole->setTabFocus (tab_type);
449
454
showDebugWindow ();
450
455
});
0 commit comments