From fb005f0419e28f16c81dd5ce1e932767e9a26435 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Tue, 6 Mar 2018 14:55:48 +0100 Subject: [PATCH] Added workaround for Qt 5.10.0+ (Windows only?) in UserNotify. QSystemTrayIcon is initially not visible but the icon gets visible after the call to ::setIcon --- retroshare-gui/src/gui/common/UserNotify.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/retroshare-gui/src/gui/common/UserNotify.cpp b/retroshare-gui/src/gui/common/UserNotify.cpp index cf83cf316..e030f9ccf 100644 --- a/retroshare-gui/src/gui/common/UserNotify.cpp +++ b/retroshare-gui/src/gui/common/UserNotify.cpp @@ -123,7 +123,21 @@ void UserNotify::createIcons(QMenu *notifyMenu) if (mTrayIcon == NULL) { /* Create the tray icon for messages */ mTrayIcon = new QSystemTrayIcon(this); +#ifdef Q_OS_WIN +#if QT_VERSION >= QT_VERSION_CHECK (5, 10, 0) + // Set tray icon visible to hide it again with ::hide. + // ::hide or ::setVisible(false) does nothing when QSystemTrayIcon is hidden. + mTrayIcon->show(); +#endif +#endif mTrayIcon->setIcon(getIcon()); +#ifdef Q_OS_WIN +#if QT_VERSION >= QT_VERSION_CHECK (5, 10, 0) + // Hide tray icon as workaround for Qt 5.10.0 (Windows only?) + // QSystemTrayIcon is initially not visible but the icon gets visible after the call to ::setIcon. + mTrayIcon->hide(); +#endif +#endif connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason))); } }