Reputation: 33
i'am trying to deploy a QT application made in QT Creator which goes back to system tray when closed.
I have made a svg tray icon, when i run it from QT Creator, either in debug and in release mode under Window 7, the tray icon shows up, but when i copy everything to another directory to make a distributable archive from it, the tray icon does not show up anymore.
Of course i search already for solutions, but everything i have found yet, i have made.
So what i have:
trayicon.svg file in project root
that is everything i found so far, but still the system tray icon is not showing up
What am i missing?
(current qt 4.8 + current qtcreator by the way)
@netrom
code in MainWindow : QMainWindow constructor:
trayIcon = new QSystemTrayIcon(this);
showAction = new QAction(tr("&Show"), this);
connect(showAction, SIGNAL(triggered()), this, SLOT(show()));
quitAction = new QAction(tr("&Quit"), this);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
trayIconMenu = new QMenu(this);
trayIconMenu->addAction(showAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
trayIcon->setContextMenu(trayIconMenu);
connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
trayIcon->setIcon(QIcon(":trayicon.svg"));
trayIcon->show();
Upvotes: 1
Views: 1977
Reputation: 525
Again, way later for DuckDuckGo-ers:
If your icon is not in .svg
you might need another solution. For my .ico
system tray icon I had to copy <path-to-qt>\plugins\imageformats
into the application folder. Actually only qico.dll
was needed in that folder in my case, but you get my drift.
Upvotes: 0
Reputation: 41
P.S. I know I'm late, this answer is for those who will google same problem.
Upvotes: 4