Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt 5.3.0 mingw
I use the following code to show tray icon, but it stays there even after I close my application, they clear only when I hover over them, what wrong am I doing?
QSystemTrayIcon *icon = new QSystemTrayIcon(QIcon(":/icons/logo.png"));
icon->showMessage(tr("Help"), tr("Help text"), QSystemTrayIcon::Information, 2000);
Since you did not give a parent to your QSystemTrayIcon, are you deleting it somewhere ?
Thanks for the quick response SGaist!
No, should I use (this) as parent?
QSystemTrayIcon *icon = new QSystemTrayIcon(QIcon(":/icons/logo.png"), this);
I am creating the icon in the main class of type (MainWindow).
PS: I have posted the same by mistake in other forum (Cloud), I could not deleted it, sorry.
Indeed you should. Without that you have a memory leak and icon will not be properly destroyed when your program ends
Thanks, it worked nicely.
You're welcome !
Since it's now all working fine, please update the thread title prepending [solved] so other forum users may know a solution has been found :)