Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Making icons work in release build : How the heck do I do this?
So I've got a GUI, made in Qt designer. And I made a resource file and I did the "/" prefix and stuffed all my icons in there. I selected the resource file entry for each icon in the GUI.
Works perfectly when you launch from Qt studio, but when you try to launch the executable or run from another computer, the icons are missing. No errors, no nothing, and no indication of what I'm supposed to do to fix. Putting the icon files in the same directory as the exe does not help. Nor does putting the QRC file there. This resource system logically should embed all the data into the exe itself. It does not seem to. So I don't know how I'm supposed to proceed.
Hi @GeraldMonroe, and welcome to the Qt Dev Net!
Works perfectly when you launch from Qt studio, but when you try to launch the executable or run from another computer, the icons are missing.
What formats are your icons in?
You might need to deploy image format plugins. See https://wiki.qt.io/Deploy_an_Application_on_Windows on where to copy the imageformats folder (you only need the DLLs that correspond to the image types that you use)
Nope. As a comment, this is abysmal. It's sheer incompetence. It's not a matter of "learn, n00b", it's just bad design. A software machine should act identically whether launched from the IDE or from the OS - to design it any other way is poor engineering. What's the point of "debugging" if the environment you are debugging in is deliberately made different than the one you run a program from, on the same computer, in the same environment, same everything.
@JKSH Ok, I had a bit of a rage attack. Your "quick and dirty" instructions DO work. It's still a chore but I feel less helpless knowing that the problem seems to be isolatable - if it runs in "release" build from the IDE, but doesn't work with Qt closed, it must be a missing DLL file installed in the Qt /<your_compiler> directory.
Still. If a DLL file is missing, this should be an error. 100%. Every time. With the exact name and binary signature of the missing file listed in the error message. Qt's DLL loader should check binary signatures as well - none of this "let's just load the wrong dll and crash" possibility of failure. Etc.
I suppose Qt isn't even meant for windows as a primary platform? Is that's why it is so badly engineered? It's all Microsoft's fault?
No, Qt is made for many platforms ( osx, win, linux , android) and image formats are optional and it would be BAD
if it complained about not loading them as most of you time you dont need those extra image plugins.
It is THE way to make a deployment folder with the DLLS you need to run on
You could add path to points to Qt release libs so clicking on exe would just launch it
but its a bad idea as other Qt programs build with different Qt dlls might pick the wrong
DLL if included in search path for Dlls.
So its by design. Its not a flaw. It how we want it to work as not to get huge issues/ DLL hell as in old time.
So Qt use side by side loading of the dlls from the folder where the exe is.
Its solid design and works really well and also allow to have multiple version of Qt installed and more.
I personally find this site good for listing minimal DLLS
and there is also tool
The Windows Deployment Tool
So make your deployment folder once and use it to test your exe outside of Creator.