PDA

View Full Version : Strange icon problem



gib
26th May 2018, 05:20
I have two Qt programs that are very similar. They have the same GUI, sharing the same .ui file, which was created with Qt Creator. The ui file includes a QToolBar that holds 8 QActions. Each action has an icon, the icons are specified in icons.qrc. In the .pro files I have the line:
RESOURCES += icons.qrc
The two .pro files are almost identical, except for differences in source file lists. Let's call them good.pro and bad.pro, building good.exe and bad.exe.
good.exe displays the icons, but bad.exe does not. When I open bad.pro with Qt Creator, open the ui file and select the toolbar object, it does not show the icons on the screen, and the action objects in the object list also do not show the icons, although the file names are there. But when I open good.pro with Qt Creator and open the ui file I can see the icons, both on screen and in the action objects. Note that this the same ui file. If I open the ui file directly with Qt Creator (i.e. not by first opening a .pro file) the icons are not displayed. This is surprising, but not necessarily significant, because I see that some other ui files that give the correct icon display in the executable also don't display the icons when open with Qt Creator.

I am baffled by this. I am using Qt Creator 2.4.1, and building with the VS2010 compiler.

Please help!

Gib

Sorry! I found my trivial mistake. The line ahead of the RESOURCES line in the bad.pro file had a '\' at the end, the result of some careless editting. When I removed that '\' the icons all returned - now that the icons.qrc file is found.