Skip to content

Commit bfd7e54

Browse files
committed
Merge #14979: [Qt] Restore < Qt5.6 compatibility for addAction
3e21b69 [Qt] Restore < Qt5.6 compatibility for addAction (Jonas Schnelli) Pull request description: #14573 broke < Qt5.6 compatibility due to calling the lambda version of `addAction` that was added in Qt5.6. This PR re-enables < Qt5.6 compatibility. Tree-SHA512: b3cf055d88a76713d100be05b2298d4091967e1a43de176af2647f59e76b98b216493dd12a6d68a942ae7946f2026e33dd8e8d20fc44a9a9614a3690ad9a2417
2 parents 3424171 + 3e21b69 commit bfd7e54

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/qt/bitcoingui.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,16 +400,18 @@ void BitcoinGUI::createMenuBar()
400400

401401
QMenu* window_menu = appMenuBar->addMenu(tr("&Window"));
402402

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, [] {
404406
qApp->focusWindow()->showMinimized();
405-
}, QKeySequence(Qt::CTRL + Qt::Key_M));
406-
407+
});
407408
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
408409
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
409410
});
410411

411412
#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, [] {
413415
QWindow* window = qApp->focusWindow();
414416
if (window->windowState() != Qt::WindowMaximized) {
415417
window->showMaximized();
@@ -422,7 +424,8 @@ void BitcoinGUI::createMenuBar()
422424
zoom_action->setEnabled(window != nullptr);
423425
});
424426
#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, [] {
426429
qApp->focusWindow()->showNormal();
427430
});
428431

@@ -433,7 +436,8 @@ void BitcoinGUI::createMenuBar()
433436

434437
if (walletFrame) {
435438
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] {
437441
GUIUtil::bringToFront(this);
438442
});
439443

@@ -444,7 +448,8 @@ void BitcoinGUI::createMenuBar()
444448

445449
window_menu->addSeparator();
446450
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] {
448453
rpcConsole->setTabFocus(tab_type);
449454
showDebugWindow();
450455
});

0 commit comments

Comments
 (0)