I wrote an image viewer plugin for Qt designer. The source code for my plugin gets compiled into the shared library for the plugin.
When I go and use and link with the plugin, I need to compile with the plugin source code. Why? This data should come from the plugin .so library. Why do I have to add the source code to my app that uses the plugin?
Pro file for plugin:
CONFIG += designer \
plugin
TARGET = $$qtLibraryTarget($$TARGET)
TEMPLATE = lib
QTDIR_build

ESTDIR = $$QT_BUILD_TREE/plugins/designer
HEADERS = imageviewerplugin.h \
../imgarch/imageviewer.h
SOURCES = imageviewerplugin.cpp \
../imgarch/imageviewer.cpp
# install
target.path = $$[QT_INSTALL_PLUGINS]/designer
sources.files = $$SOURCES \
$$HEADERS \
*.pro
sources.path = ./imageviewerplugin
INSTALLS += target \
sources
INCLUDEPATH += ../imgarch
Pro file for app using the plugin:
QT += network
TARGET = useplug
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp \
../imgarch/imageviewer.cpp
HEADERS += mainwindow.h \
../imgarch/imageviewer.h
FORMS += mainwindow.ui
INCLUDEPATH += /home/johnpaul/imgarch
As you can see the imageviewer.cpp file has to be included in both projects. WHY???