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:
TEMPLATE = lib
HEADERS += testFile.h
SOURCE += testFile.cpp
CONFIG += debug static
RESOURCES += testFile.qrc # the images are stored as resources
QTPLUGIN += qjpeg
TEMPLATE = lib
HEADERS += testFile.h
SOURCE += testFile.cpp
CONFIG += debug static
RESOURCES += testFile.qrc # the images are stored as resources
QTPLUGIN += qjpeg
To copy to clipboard, switch view to plain text mode
I use the Q_IMPORT_PLUGIN(qjpeg) in the library source file.
the content of the application pro file is as follows:
TEMPLATE = app
SOURCES += main.cpp
CONFIG += debug qt x11
LIBS += libTestFile.a # the library mentioned above
TEMPLATE = app
SOURCES += main.cpp
CONFIG += debug qt x11
LIBS += libTestFile.a # the library mentioned above
To copy to clipboard, switch view to plain text mode
the code block is as follows:
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();
}
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
testFile file1; // constructs a toolbar having an icon (a jpeg image is used as icon)
file1.show(); // shows the toolbar
return app.exec();
}
To copy to clipboard, switch view to plain text mode
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
QTPLUGIN += jpeg
QTPLUGIN += jpeg
To copy to clipboard, switch view to plain text mode
to the pro file of the application, the application is built but the image is not visible on the toolbar.
how can I embed the images to the library and use it in the application ?
Bookmarks