hi,
i have been trying to import plugins to a library and link that library to another application.
the library pro file is as the following:
Code:
TEMPLATE = lib HEADERS += testFile.h SOURCE += testFile.cpp CONFIG += debug static RESOURCES += testFile.qrc # the images are stored as resources QTPLUGIN += qjpeg
I use the Q_IMPORT_PLUGIN(qjpeg) in the library source file.
the content of the application pro file is as follows:
Code:
TEMPLATE = app SOURCES += main.cpp CONFIG += debug qt x11 LIBS += libTestFile.a # the library mentioned above
the code block is as follows:
Code:
int main(int argc, char* argv[]) { testFile file1; // constructs a toolbar having an icon (a jpeg image is used as icon) file1.show(); // shows the toolbar return app.exec(); }
without using the libraries and embedding the library code into the application code, the jpeg file is displayed correctly.
when using libraries, the jpeg plugin's static library is not linked to my library and when I compile the application, I get an error message regarding the Q_IMPORT_PLUGIN (undefined reference to qt_plugin_instance_qjpeg()). when I add
to the pro file of the application, the application is built but the image is not visible on the toolbar.Code:
QTPLUGIN += jpeg
how can I embed the images to the library and use it in the application ?