Qt/C++: Icons not showing up when program is run
Did you make a QRC file (that is, Qt's equivalent of a resource file?) If not, that would explain what you're seeing. The icons will show up in the creator, but not in the final compiled executable. Have a look at this:
http://doc.qt.io/qt-5/resources.html
I found myself doing all the right stuff, adding a qrc file and placing my icons there. When I run the program no deal. Turn out I was forgetting to run qmake:
- Right click your project's name and select "Run qmake". Or go to Build>Run qmake.
Everytime you change something in the .pro file you need to run qmake again. Creating a resource file implicitly adds argunments to the .pro file, so you need to do it.
Hope it helps other people out there.
Also in case of shadow build don't forget to use windeployqt.exe on your application executable file. After that several folders will be added to your build directory. Particulary two important folders: iconengines and imageformats which contain several dlls needed to load and draw the icon.