You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, July 8th 2009, 4:23pm

Qt Designer plugin question

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:DESTDIR = $$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???