Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

include the jpeg plugin in my application

Tags:

plugins

jpeg

qt

I made a Qt GUI application that loads jpeg files. On my development system (Win7) where I have installed the QtSDK (4.7.3) it works. When I move the application and some required dlls (like QtGui4.dll and others) to another system, where the QtSDK isnt installed, the program executes, but cant load jpegs. I read, that i have to add the jpeg plugin, but I dont know how.

I already tried this in my main.cpp:

Q_IMPORT_PLUGIN(qjpeg);

together with this in my project file:

QTPLUGIN += qjpeg

But I got the error:

cannot find -lqjpegd

I dont care if I include this plugin in a dynamic or a static way. I just need my application to work on other systems. I prefer the way that is simpler. What I tried is the static way, right? How can I just include it as a dll file in my application ? I also checked my

mingw\plugins\imageformats

directory and there is really no qjpeg.dll. But there are:

qjpeg4.dll qjpegd4.dll libqjpeg4.a

Than i tried it with:

Q_IMPORT_PLUGIN(qjpeg4);
QTPLUGIN += qjpeg4

But got the same error msg. Whats wrong?

Thanks for your answers!

like image 879
obs Avatar asked Jul 17 '11 14:07

obs


1 Answers

Copy the plugins\imageformats folder into your application directory. In your main(), add this

QApplication a(argc, argv);
QString sDir = QCoreApplication::applicationDirPath();
a.addLibraryPath(sDir+"/plugins");
like image 165
Lwin Htoo Ko Avatar answered Nov 12 '22 19:11

Lwin Htoo Ko