Results 1 to 8 of 8

Thread: Plugin and shared class between plugin and application

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Plugin and shared class between plugin and application

    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 :
    Qt Code:
    1. class Item : public QGraphicsWidget{
    2. Q_OBJECT
    3. public:
    4. Item(QGraphicsItem * parent) : QGraphicsWidget(parent){};
    5. ~Item(){};
    6. virtual bool isBackground() = 0;
    7. virtual QList<PropertyInfo> getProperties() = 0;
    8.  
    9. signals:
    10. void background(bool background);
    11. void propertyUpdate();
    12. };
    13.  
    14. class ItemCreator{
    15. public:
    16. ~ItemCreator(){};
    17. virtual Item * createItem(QByteArray init);
    18. };
    19.  
    20. class Plugin
    21. {
    22. public:
    23. virtual ~Plugin() {};
    24. virtual QString getName() = 0;
    25. virtual QList<QMenu * > getMenus() = 0;
    26. virtual ItemCreator getItemCreator() = 0;
    27. virtual QList<QByteArray *> getInitValues() = 0;
    28. };
    29.  
    30. Q_DECLARE_INTERFACE(Plugin,
    31. "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.
    Last edited by wishper; 18th August 2010 at 15:25.

Similar Threads

  1. Replies: 7
    Last Post: 11th April 2013, 10:55
  2. Qt Creator Custom widget plugin being replaced with parent class
    By mhill in forum Qt Tools
    Replies: 0
    Last Post: 28th July 2010, 18:58
  3. Class name mismatch for plugin
    By martinb0820 in forum Qt Tools
    Replies: 3
    Last Post: 20th August 2008, 13:47
  4. What about a plugin application?
    By Raccoon29 in forum Newbie
    Replies: 4
    Last Post: 16th March 2008, 16:36
  5. [SOLVED] Q_ENUMS from another class inside a plugin
    By desch in forum Qt Programming
    Replies: 1
    Last Post: 1st December 2007, 15:44

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.