[Solved] QT Resource File - Images Not Showing When Running
-
Hi and welcome to devnet,
Try running qmake when you modify your qrc file. The corresponding C++ file must be regenerated when you modify it.
Hope it helps
-
I'm relatively new to QT, and C++ in general, so is that something I have to do with a program outside of QT?
-
Ok I think I may have figured it out and it may be the fact that I am a complete noob with QT. There is literally the option to right click on the project and say "run qmake". I did that on my test application and it started displaying the image. I am going to fix up my main app I was working on earlier and see if that same solution fixes that as well. I will let you know the results.
-
Yep, that was it. Just so everyone is aware of the solution, it was simply to right click the project and click "Run qmake".
Thanks again to all those who helped!
-
You're welcome !
Since now you have your qrc file working, please update the thread title prepending [solved] so other forum users may know a solution has been found :)
-
@SGaist
This problem usually happen when you have two Resource file with same name!(*.qrc).
For testing create a main project and create an external library project. Create two res.qrc file with same name.
Sometimes you can not see the icons and images on forms or dialogs on the library you have attached to your project. It is rare to see as usually a little number of programmers create a dialog in their LIBS. (for example having your own MESSAGEBOX in an external LIB)
I think this is a bug which should be reported to 'qt but report site'regards
-
@Hasan-Vaez Not in this case, it was just missing a refresh of the generated code.
-
@SGaist Hi,
I'm also facing the same issue of resource images not visible when the app is running. I have a plugin-based architecture. Lets say,- NavControls, a staticLib, in which we have the icons.
- The NavControls lib is used by a Plugin (VIEWERSHARED_EXPORT). I added it in the .pro fo Viewer Plugin
//win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../Deploy/bin/release/ -lNavControls else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../Deploy/bin/debug/ -lNavControls INCLUDEPATH += $$PWD/../NavControls DEPENDPATH += $$PWD/../NavControls
- This Viewer plugin implements an Interface.
- Finally, I load the plugin in the app, by QPluginLoader class..
The plugin loads without any warnings, but the images are missing on the navControl's buttons.
Please suggest what I'm missing!!
Thanks,
Sayan -
Hi,
You likely missed the Using Resources in a Library part of the
The Qt Resource System
chapter in Qt's documentation.