aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2019-01-15 15:13:18 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2019-01-15 15:27:10 +0100
commita5daf70ffb80c14ddf9f35c638d9e8087d8732e9 (patch)
treeca1c9b2c88c4f65e7b9896ef2e643f55c0831490 /src
parent1b6fc30530459eae8cff2ac95206719e4c664a55 (diff)
parenta88640e123ca0c00d81719f9a009699c26e85b90 (diff)
Merge #14594: qt: Fix minimized window bug on Linux
a88640e123ca0c00d81719f9a009699c26e85b90 Fix minimized window bug on Linux (Hennadii Stepanov) Pull request description: Fix #14591 On some Linux systems the minimized to the taskbar (iconified) main window cannot be restored properly using actions from the systray icon menu when `QSystemTrayIcon::contextMenu()` is a child of the main window. Tree-SHA512: 05c9f724fc2278d45dac6fe72b09859f12b5d71f54659bb779403c8cd81b55e610fb7b5aa912ac273d3cd19bf953b0405bbc6451feb00d1827c95dd9f0876aa4
Diffstat (limited to 'src')
-rw-r--r--src/qt/bitcoingui.cpp10
-rw-r--r--src/qt/bitcoingui.h4
2 files changed, 7 insertions, 7 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 77130c8c63..98ad2b38e1 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -35,6 +35,7 @@
#include <util/system.h>
#include <iostream>
+#include <memory>
#include <QAction>
#include <QApplication>
@@ -43,6 +44,7 @@
#include <QDesktopWidget>
#include <QDragEnterEvent>
#include <QListWidget>
+#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QMimeData>
@@ -52,6 +54,7 @@
#include <QStackedWidget>
#include <QStatusBar>
#include <QStyle>
+#include <QSystemTrayIcon>
#include <QTimer>
#include <QToolBar>
#include <QUrlQuery>
@@ -72,6 +75,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
QMainWindow(parent),
m_node(node),
+ trayIconMenu{new QMenu()},
platformStyle(_platformStyle)
{
QSettings settings;
@@ -657,16 +661,12 @@ void BitcoinGUI::createTrayIconMenu()
if (!trayIcon)
return;
- trayIconMenu = new QMenu(this);
- trayIcon->setContextMenu(trayIconMenu);
-
+ trayIcon->setContextMenu(trayIconMenu.get());
connect(trayIcon, &QSystemTrayIcon::activated, this, &BitcoinGUI::trayIconActivated);
#else
// Note: On macOS, the Dock icon is used to provide the tray's functionality.
MacDockIconHandler *dockIconHandler = MacDockIconHandler::instance();
connect(dockIconHandler, &MacDockIconHandler::dockIconClicked, this, &BitcoinGUI::macosDockIconActivated);
-
- trayIconMenu = new QMenu(this);
trayIconMenu->setAsDockMenu();
#endif
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 48e96d6169..4e52322521 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -16,7 +16,6 @@
#include <QLabel>
#include <QMainWindow>
#include <QMap>
-#include <QMenu>
#include <QPoint>
#include <QSystemTrayIcon>
@@ -47,6 +46,7 @@ class Node;
QT_BEGIN_NAMESPACE
class QAction;
class QComboBox;
+class QMenu;
class QProgressBar;
class QProgressDialog;
QT_END_NAMESPACE
@@ -146,7 +146,7 @@ private:
QComboBox* m_wallet_selector = nullptr;
QSystemTrayIcon* trayIcon = nullptr;
- QMenu* trayIconMenu = nullptr;
+ const std::unique_ptr<QMenu> trayIconMenu;
Notificator* notificator = nullptr;
RPCConsole* rpcConsole = nullptr;
HelpMessageDialog* helpMessageDialog = nullptr;