Please help. I am having the same problem - the tray icon displays correctly on the machine where I build the project, but shows as a blank spot on any other machine.
I am using VS2010 with the Designer plug-in, QT 4.7.2, on Windows. The icon is an .ico file, located in a sub-directory under the project directory. It has 16x16, 32x32, 64x64 sizes for 8 and 32 bit colors, no compression.
I have confirmed that the icon is embedded correctly - I have been able to access it via QFile(":/<icon's path>"), moreover the tray icon area itself displays tooltips and messages without an issue. A built-in icon is displayed fine in any of these scenarios.
Below is the code that creates, and tries to show, the tray icon:
QIcon icon
(":/QtManagerConsole/Resources/new.ico");
trayIcon->setToolTip(tr("Test Tooltip"));
trayIcon->setVisible(true);
//desperate attempts...
trayIcon->setIcon(icon);
trayIcon->show();
//Verifying that the file is embeded
QFile file(":/QtManagerConsole/Resources/new.ico");
qint64 size = file.size();
trayIcon
->showMessage
("Icon loaded",
QString("Size: %1").
arg(size
));
QIcon icon(":/QtManagerConsole/Resources/new.ico");
trayIcon = new QSystemTrayIcon(icon, this);
trayIcon->setToolTip(tr("Test Tooltip"));
trayIcon->setVisible(true);
//desperate attempts...
trayIcon->setIcon(icon);
trayIcon->show();
//Verifying that the file is embeded
QFile file(":/QtManagerConsole/Resources/new.ico");
qint64 size = file.size();
trayIcon->showMessage("Icon loaded", QString("Size: %1").arg(size));
To copy to clipboard, switch view to plain text mode
Thank you,
Leo.
Bookmarks