aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2018-10-28 15:48:05 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2019-01-04 20:01:20 +0200
commita88640e123ca0c00d81719f9a009699c26e85b90 (patch)
tree5baf4c85696b71c6409d25e5c82c5e200d92e114 /src/qt/bitcoingui.cpp
parentc651265c934c84c683aa054f2a456b12acc41590 (diff)
Fix minimized window bug on Linux
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.
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index ef82351551..d7e8d810cc 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -36,6 +36,7 @@
#include <util/system.h>
#include <iostream>
+#include <memory>
#include <QAction>
#include <QApplication>
@@ -44,6 +45,7 @@
#include <QDesktopWidget>
#include <QDragEnterEvent>
#include <QListWidget>
+#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QMimeData>
@@ -53,6 +55,7 @@
#include <QStackedWidget>
#include <QStatusBar>
#include <QStyle>
+#include <QSystemTrayIcon>
#include <QTimer>
#include <QToolBar>
#include <QUrlQuery>
@@ -73,6 +76,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;
@@ -610,16 +614,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