PDA

View Full Version : Location of imageformats directory



KenJustKen
19th January 2012, 14:07
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?



int main(int argc, char *argv[])
{
QString Path1,ImagePath;
QtSingleApplication a(argc, argv); // Added
if (a.isRunning()) // Added
return 0; // Added

//--------------------------------------------------
// Force location of the image loading dlls files
//--------------------------------------------------
Path1 = QCoreApplication::applicationDirPath();

ImagePath = Path1+"/"+"Plugins";
QCoreApplication::addLibraryPath(ImagePath);

ImagePath = Path1+"/"+"Plugins/imageformats";
QCoreApplication::addLibraryPath(ImagePath);


MyAppWindow w;
a.setActivationWindow(&w); // Added
//w.cmd_line_args = args;
w.show();
return a.exec();

}

ChrisW67
20th January 2012, 01:07
The Qt plugins deployed with your application will be found by default, no addLibraryPath() required, if you deploy them like this (Windows):


C:\Program Files\
Cool App Dir\
coolapp.exe
qtcore4.dll
qtgui4.dll
...
imageformats\
qjeg4.dll
qgif4.dll
...
sqldrivers\
qsqlite.dll
plugins\
// any plugin you have written for your program to load directly

masher
20th September 2012, 00:26
I also needed to add the qico4.dll to my build

so,
1.C:\Program Files\
2. Cool App Dir\
3. coolapp.exe
4. qtcore4.dll
5. qtgui4.dll
6. ...
7. imageformats\
8. qjeg4.dll
9. qico4.dll (this also needed to be added)

The above worked great for my particular build. Thanks again!!!
-masher