QPlugin inter Dependency
-
Hi,
I have two plugins that are dynamically linked and are loaded by QPluginLoader which is contained with the main project. I have created a method to ensure that if plugins have a dependency on another plugin that the plugins are loaded in the correct order to satisfy their dependencies.
Loading of plugin:
QPluginLoader pluginLoader(itor->PluginPath); QObject *tempPlugin = pluginLoader.instance();
Plugin one:
#include "PluginInterface.h"
class NewWizardPlugin: public PluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "Code.PluginInterface" FILE "NewViewPlugin.json")
Q_INTERFACES(PluginInterface)
public:
NewWizardPlugin();virtual ~NewWizardPlugin();
};
Plugin Two
``
#include "PluginInterface.h"
#include "NewWizardPlugin.h"
class newStandardSubwizard: public PluginInterface
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "Code.PluginInterface" FILE "New_standard_subwizard.json")
Q_INTERFACES(PluginInterface)
public:newStandardSubwizard(); virtual ~newStandardSubwizard(); };
``
Now depending on what I do next one of two things happen.
If i just reference the header file of the other plugin as done above in the header file I get a symbolic link error from the QPluginLoader. Or if I add the header ("NewWizardPlugin.h") to the include headers of the .pro file for the newStandardSubwizard plugin, I get moc errors. Has anyone done this before, can offer any ideas, i'm fairly stuck on this. -
Hi,
For the interface part, you could have a common library that offers all the interfaces (e.g. MyAbstractPluginInterface) that your plugin will use and link to that library.
Hope it helps