Qt MINGW Resource Issue
-
Hello all,
I recently switched my QT 5.14.2 compiler from MSVC2017 to MINGW 64 7.3.0 64 bit on Windows 10 64 bit. The project I'm building is a subdir project, with the subdir projects built as static libraries.
Each project has a resource file calls 'resources' with all the images, icons etc. stored in it. In the classes of each project, the resources are imported like so:
Q_INIT_RESOURCE(resources);
During runtime, all loaded images are null. I've used the QT deploy tool to copy the required DLLs and plugins to the executable path. The required image plugins are inside 'imageformat' in the same folder as the executable.
I'm not sure what I'm doing wrong since my MSVC build works perfectly fine with all the resources loading properly.
Any tips would be very much appreciated!
Cheers!
-
First make sure if the resource gets really loaded by checking if the files can be access with QFile::exists(":/..."). If it's the case than you called Q_INIT_RESOURCE() correctly and the needed plugin doesn't get loaded -> see QT_DEBUG_PLUGINS.
-
@Christian-Ehrlicher QFile::exists returns false. I created an environment variable QT_DEBUG_PLUGINS with a value of 1, how can I debug plugin issues?
-
@rtavakko said in Qt MINGW Resource Issue:
how can I debug plugin issues?
Start your application after setting QT_DEBUG_PLUGINS and check the output of the application.
-
@rtavakko said in Qt MINGW Resource Issue:
QFile::exists returns false.
So fix your resource path
I created an environment variable QT_DEBUG_PLUGINS with a value of 1, how can I debug plugin issues?
Why do you want to debug the plugins when the file can not be found in the first place?
-
@Christian-Ehrlicher How do I fix the resource path? The path seems correct since it is found and resources load correctly when using the MSVC compiler.
-
You should at least make sure Q_INIT_RESOURCE() is really called before you try to load something from there.
-
@Christian-Ehrlicher What do you mean really make sure?
I call it inside the constructor of classes of my static libraries (if the class uses resources).
In my GUI application I call it in main after the application class (QApplication in this case) is created and before the main window is created.