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
This commit is contained in:
thunder2 2018-03-06 14:55:48 +01:00
parent d63655c9b6
commit fb005f0419

View File

@ -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)));
}
}