Reputation: 43
i have a annoying issue with showing jpg images with qt. I devlope with Visual Studio 2008 in Windows 7 and using the Qt version 4.8.2. I will now describe my problem by means of the "collidingmice" example deliverd with Qt (../examples/graphicsview/collidingmice).
I can build this example via Visual Studio IDE or with via the Visual Studio command prompt. In this example a jpg is used as background and is correctly shown when I execute the debug executable. But in release build this background jpg is not shown.
I already realized, that Qt uses plugins for loading/showing different images. Therefore I copied the contents of the plugin folder of Qt into the application directory (where collidingmice.exe is). Unfortunatly, this does not solve the problem.
Hence, I thought there must be something wrong with the Qt build and the jpeg library. Therefore, I reconfigured Qt by executing the following commands in the Visual Studio command prompt:
nmake distclean
configure -debug-and-release -opensource -platform win32-msvc2008 -qt-libjpeg -no-webkit
nmake
After that did a rebuild of the example, but again the jpg image is not shown. I am not sure what the problem is since it works in debug build and in release I think I only have to deliver the needed plugin DLLs. But obviously I am not right.
I hope anyone can help me or can give me some hints where the problem might be. Thanks!
Upvotes: 4
Views: 5795
Reputation: 36630
Therefore I copied the contents of the plugin folder of Qt into the application directory (where collidingmice.exe is).
You need to put the plugins into an "imageformats" subdirectory, e.g. like
bin
├── collidingmice.exe
└── imageformats
├── qjpeg4.dll
├ ...
See also http://www.qtcentre.org/threads/46927-Location-of-imageformats-directory
It turned out that the OP had already set up the directory structure accordingly. The root cause was that a wrong QtGui4.dll has been loaded. This can be fixed "by copying the DLL directly into the application directory or by changing the order of the paths in the PATH environment variable so that your Qt bin directory is placed in front of all other paths containing a QtGui4.dll."
In any case, the Process Monitor is a good tool to track down such issues.
Upvotes: 7