Hi !
Well, I need to create a plugin manager, and some plugins to my application.
The goal of a plugin is to provide new items to the main application, extended from QGraphicsWidget with a few more methods and signals.
Since a plugin must be a pure interface, I realized one with some functions to communicate with the application.
Since the item is used by the application, but also need to be know by the plugin to create them, I include in the header of the plugin the declaration of the Item (it's a QGraphicsWidget with some pure virtual methods)
I manage to get my program and my plugin to compile. However, when I load the plugin, I get this error (came from pluginLoader.errorString() ) :
PluginManager : instance failed "Cannot load library /home/wishper/trunk/release/Plugins/lib_basicitems.so: (/home/wishper/trunk/release/Plugins/lib_basicitems.so: undefined symbol: _ZN4Item16staticMetaObjectE)"
Here is the light version of the header :
class Item : public QGraphicsWidget{
Q_OBJECT
public:
~Item(){};
virtual bool isBackground() = 0;
virtual QList<PropertyInfo> getProperties() = 0;
signals:
void background(bool background);
void propertyUpdate();
};
class ItemCreator{
public:
~ItemCreator(){};
};
class Plugin
{
public:
virtual ~Plugin() {};
virtual QList<QMenu * > getMenus() = 0;
virtual ItemCreator getItemCreator() = 0;
virtual QList<QByteArray *> getInitValues() = 0;
};
Q_DECLARE_INTERFACE(Plugin,
"fr.neticoa.xsimulbeta.plugin/1.0")
class Item : public QGraphicsWidget{
Q_OBJECT
public:
Item(QGraphicsItem * parent) : QGraphicsWidget(parent){};
~Item(){};
virtual bool isBackground() = 0;
virtual QList<PropertyInfo> getProperties() = 0;
signals:
void background(bool background);
void propertyUpdate();
};
class ItemCreator{
public:
~ItemCreator(){};
virtual Item * createItem(QByteArray init);
};
class Plugin
{
public:
virtual ~Plugin() {};
virtual QString getName() = 0;
virtual QList<QMenu * > getMenus() = 0;
virtual ItemCreator getItemCreator() = 0;
virtual QList<QByteArray *> getInitValues() = 0;
};
Q_DECLARE_INTERFACE(Plugin,
"fr.neticoa.xsimulbeta.plugin/1.0")
To copy to clipboard, switch view to plain text mode
What I see with the error is that the problem came from the Item class. I really don't understand what is the problem. I tried many things, but the result is always the same.
Am I doing things wrong ?
Thanks a lot, regards.
wishper.
Bookmarks