I use a class named SvgIconEngine that is subclassed from QIconEngineV2 to paint the system tray's (QSystemTrayIcon) icon.
SvgIconEngine *engine = new SvgIconEngine;
engine->loadSvgFromFile(":/icon.svg");
mSysTray
->setIcon
(QIcon(engine
) );
// mSysTray = QSystemTrayIcon
SvgIconEngine *engine = new SvgIconEngine;
engine->loadSvgFromFile(":/icon.svg");
mSysTray->setIcon(QIcon(engine) ); // mSysTray = QSystemTrayIcon
To copy to clipboard, switch view to plain text mode
The paint code is the following:
void SvgIconEngine
::paint(QPainter *painter,
const QRect
& rect,
{
mRenderer.render(painter, rect); // mRenderer = QSvgRenderer object
}
void SvgIconEngine::paint(QPainter *painter, const QRect& rect,
QIcon::Mode mode, QIcon::State state)
{
mRenderer.render(painter, rect); // mRenderer = QSvgRenderer object
}
To copy to clipboard, switch view to plain text mode
In Windows XP I have this problem:

Where there should be the transparency there are some weird colorful pixels which undoubtedly are not part of system tray's background.
I have this problem only in Windows. In Linux/KDE everything works perfectly.
Anyone has an idea?
Bookmarks