Skip to content

Commit

Permalink
Merge bitcoin#18549: qt: Fix Window -> Minimize menu item
Browse files Browse the repository at this point in the history
56fe839 qt: Fix Window -> Minimize menu item (Hennadii Stepanov)

Pull request description:

  Now Window -> Minimize menu item is broken on Linux.

  Steps to reproduce:

  1. start `bitcoin-qt`
  2. activate Window -> Minimize menu item with a keyboard (not by a shortcut) or a mouse

  **Expected behavior**

  The main window gets minimized.

  **Actual behavior**

  The main window still unchanged. Even worse: the menu widget becomes a separate window:

  ![Screenshot from 2020-04-07 00-32-02](https://user-images.githubusercontent.com/32963518/78608129-ffb1dd80-7868-11ea-8e73-62ecc140ac1f.png)

  This PR does not touch the macOS specific code as `qApp->focusWindow()` seems work on macOS flawlessly.

ACKs for top commit:
  promag:
    Tested ACK 56fe839 on bionic with qt 5.9.5.

Tree-SHA512: 3582e44ba181d859f5994b9cddc6ce1b60aa1db520a31dd3a0684336c79d558d7410ce7a1ab5b0860c6431b54d8acc3aa16e399717b4c70839861e6b6c4290c0
  • Loading branch information
MarcoFalke authored and PastaPastaPasta committed Sep 17, 2021
1 parent 786b206 commit b05763a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,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);
Expand Down

0 comments on commit b05763a

Please sign in to comment.