mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 12:22:39 -03:00
Merge #14979: [Qt] Restore < Qt5.6 compatibility for addAction
3e21b690d1
[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
This commit is contained in:
commit
bfd7e54097
1 changed files with 12 additions and 7 deletions
|
@ -400,16 +400,18 @@ void BitcoinGUI::createMenuBar()
|
||||||
|
|
||||||
QMenu* window_menu = appMenuBar->addMenu(tr("&Window"));
|
QMenu* window_menu = appMenuBar->addMenu(tr("&Window"));
|
||||||
|
|
||||||
QAction* minimize_action = window_menu->addAction(tr("Minimize"), [] {
|
QAction* minimize_action = window_menu->addAction(tr("Minimize"));
|
||||||
|
minimize_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
|
||||||
|
connect(minimize_action, &QAction::triggered, [] {
|
||||||
qApp->focusWindow()->showMinimized();
|
qApp->focusWindow()->showMinimized();
|
||||||
}, QKeySequence(Qt::CTRL + Qt::Key_M));
|
});
|
||||||
|
|
||||||
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
|
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
|
||||||
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
|
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);
|
||||||
});
|
});
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
QAction* zoom_action = window_menu->addAction(tr("Zoom"), [] {
|
QAction* zoom_action = window_menu->addAction(tr("Zoom"));
|
||||||
|
connect(zoom_action, &QAction::triggered, [] {
|
||||||
QWindow* window = qApp->focusWindow();
|
QWindow* window = qApp->focusWindow();
|
||||||
if (window->windowState() != Qt::WindowMaximized) {
|
if (window->windowState() != Qt::WindowMaximized) {
|
||||||
window->showMaximized();
|
window->showMaximized();
|
||||||
|
@ -422,7 +424,8 @@ void BitcoinGUI::createMenuBar()
|
||||||
zoom_action->setEnabled(window != nullptr);
|
zoom_action->setEnabled(window != nullptr);
|
||||||
});
|
});
|
||||||
#else
|
#else
|
||||||
QAction* restore_action = window_menu->addAction(tr("Restore"), [] {
|
QAction* restore_action = window_menu->addAction(tr("Restore"));
|
||||||
|
connect(restore_action, &QAction::triggered, [] {
|
||||||
qApp->focusWindow()->showNormal();
|
qApp->focusWindow()->showNormal();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -433,7 +436,8 @@ void BitcoinGUI::createMenuBar()
|
||||||
|
|
||||||
if (walletFrame) {
|
if (walletFrame) {
|
||||||
window_menu->addSeparator();
|
window_menu->addSeparator();
|
||||||
window_menu->addAction(tr("Main Window"), [this] {
|
QAction* main_window_action = window_menu->addAction(tr("Main Window"));
|
||||||
|
connect(main_window_action, &QAction::triggered, [this] {
|
||||||
GUIUtil::bringToFront(this);
|
GUIUtil::bringToFront(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -444,7 +448,8 @@ void BitcoinGUI::createMenuBar()
|
||||||
|
|
||||||
window_menu->addSeparator();
|
window_menu->addSeparator();
|
||||||
for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) {
|
for (RPCConsole::TabTypes tab_type : rpcConsole->tabs()) {
|
||||||
window_menu->addAction(rpcConsole->tabTitle(tab_type), [this, tab_type] {
|
QAction* tab_action = window_menu->addAction(rpcConsole->tabTitle(tab_type));
|
||||||
|
connect(tab_action, &QAction::triggered, [this, tab_type] {
|
||||||
rpcConsole->setTabFocus(tab_type);
|
rpcConsole->setTabFocus(tab_type);
|
||||||
showDebugWindow();
|
showDebugWindow();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue