qt: Fix Window -> Minimize menu item

This commit is contained in:
Hennadii Stepanov 2020-04-07 00:19:19 +03:00
parent abc145c9a4
commit 56fe839e4e
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -456,7 +456,7 @@ void BitcoinGUI::createMenuBar()
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();
QApplication::activeWindow()->showMinimized();
});
connect(qApp, &QApplication::focusWindowChanged, [minimize_action] (QWindow* window) {
minimize_action->setEnabled(window != nullptr && (window->flags() & Qt::Dialog) != Qt::Dialog && window->windowState() != Qt::WindowMinimized);