Alexandru Chirila
Alexandru Chirila

Reputation: 2352

How to statically link Qt image formats plugins for WebKit?

I need a QWebView to display images, instead of the question marks it currently displays.

I have found that i need to link some image plugins to my application to do so. I have researched this problem for a while now, and I haven't found a satisfying solution.

I followed these steps:

1) I have added in my project folder and the folder in which the application is compiled a folder named: imageformats/ in which i have put these folowing plugins: libqgif.so and libqjpeg.so

2) I have added to my project configuration file (.pro) this:

 QTPLUGIN     += qjpeg \
                 qgif 

3) And I have added to the .cpp containg the main function of my project this:

#include <QtPlugin>

Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qgif)

And i get the following errors:

main.cpp:(.text.startup+0xce): undefined reference to `qt_plugin_instance_qjpeg()'
main.cpp:(.text.startup+0xda): undefined reference to `qt_plugin_instance_qgif()'

I also tried changing the directory to plugins/imageformats/, but it made no difference whatsoever.

Upvotes: 2

Views: 1441

Answers (1)

Chilkari
Chilkari

Reputation: 11

For me (on Ubuntu 12.04), I didn't have libjpeg and dev headers installed.

$ sudo apt-get install libjpeg62-dev

(which will also install libjpeg62 if you don't have it).

After this, my QTWebView showed jpeg images without any extra modifications.

Upvotes: 1

Related Questions