[Solved] SysTray svg icon missing on Windows 7
-
wrote on 25 Apr 2014, 21:01 last edited by
I am writing a small program - the SysTray svg icon is visible on Ubuntu (though in a wrong place), but completely missing - just an empty space - on Windows 7 (though the context menu is available when right-clicking on this empty space).
At runtime there are two error lines in the application console:
Cannot open file ':/dch.svg', because: Unknown error
Cannot open file ':/dch.svg', because: Unknown errorat this string of loading the icon:
QIcon *SysTrayIcon = new QIcon(":/dch.svg");
It is Windows 7 32-bit, Qt 5.2.1, MinGW48-32
All the libraries are written in .pro file and made available in the build folder and sub-folders "platforms" and "plugins". When opening the .qrc file in QtCreator, the icon is perfectly displayed.
Have tried to change the slash to backslash, to put the icon in build folder, not in /res, another folder up, root folder - no way.
-
Hi and welcome to devnet,
IIRC you would need the QtSvg module to load svg files.
On a side note, you shouldn't need to allocate a QIcon on the heap. You are probably creating a memory leak here
-
wrote on 25 Apr 2014, 22:17 last edited by
Qt5Svg is and was here all the time with no success...
Thank you for the side note - I am new to C++, just learning :)
@ QIcon SysTrayIcon;
SysTrayIcon.addFile(":/dch.svg");
@But the icon still missing...
-
wrote on 27 Apr 2014, 01:14 last edited by
Problem solved removing the language from ,qrc file
-
wrote on 27 Apr 2014, 18:18 last edited by
Hi,
Please add [solved] to the title of your first post to inform others
-
Out of curiosity, what do you mean by removing the language from the qrc file ?
-
wrote on 27 Apr 2014, 22:43 last edited by
@<RCC>
<qresource lang="en" prefix="/">
@My Windows 7 is russian, so now I think specifying lang="en" wasn't exactly smart :) but Im just learning...
-
Thanks for the reminder, I've forgot that technique :)
8/8