I am having a problem with my imageformats directory. There are some web links that say that this should be under my program directory “program dir”\imageformats and other links that say that this should be un “program dir”\plugins\imageformats. There are others that say you can set the directory by using the addLibraryPath as shown below.

However, no matter what I do, the only way I can get my code to load the images is to have the jpeg.dll and other format conversion DLLs located at “program Directory”\imageformats\*.dll . Since I can not explain this, I do not feel safe releasing this code to production. Can someone explain to me what the correct location of the files should be and why the below code does not work to force the location of the qgif4.dll, qjpeg4.dll, qmng4.dll, and other files?


Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QString Path1,ImagePath;
  4. QtSingleApplication a(argc, argv); // Added
  5. if (a.isRunning()) // Added
  6. return 0; // Added
  7.  
  8. //--------------------------------------------------
  9. // Force location of the image loading dlls files
  10. //--------------------------------------------------
  11. Path1 = QCoreApplication::applicationDirPath();
  12.  
  13. ImagePath = Path1+"/"+"Plugins";
  14. QCoreApplication::addLibraryPath(ImagePath);
  15.  
  16. ImagePath = Path1+"/"+"Plugins/imageformats";
  17. QCoreApplication::addLibraryPath(ImagePath);
  18.  
  19.  
  20. MyAppWindow w;
  21. a.setActivationWindow(&w); // Added
  22. //w.cmd_line_args = args;
  23. w.show();
  24. return a.exec();
  25.  
  26. }
To copy to clipboard, switch view to plain text mode