Hi all

I have application which load all plugins in directory plugins and show thier menus. I do this in class plugins:

Qt Code:
  1. bool Plugins::loadPlugins()
  2. {
  3. QDir dir("./plugins");
  4. if (!dir.exists())
  5. return false;
  6.  
  7. foreach (QString filename, dir.entryList(QDir::Files))
  8. {
  9. loader->setFileName(dir.absoluteFilePath(filename));
  10. QObject *couldBeFilter = loader->instance();
  11. if (couldBeFilter)
  12. {
  13. PluginInterface *plugin = qobject_cast<PluginInterface*>(couldBeFilter);
  14. if (plugin)
  15. {
  16. plugins.insert(plugin->name(), plugin);
  17. connect(plugin->menu(), SIGNAL(writeData(QByteArray)), this, SIGNAL(dataOut(QByteArray)));
  18. }
  19. }
  20. }
  21.  
  22. return true;
  23. }
To copy to clipboard, switch view to plain text mode 

Then I have class PluginInterface:

Qt Code:
  1. class PluginInterface
  2. {
  3.  
  4. public:
  5. virtual QString name() const = 0;
  6. virtual Menu* menu() const = 0;
  7. };
  8.  
  9. Q_DECLARE_INTERFACE(PluginInterface, "sk.kimle.PluginInterface/0.1")
To copy to clipboard, switch view to plain text mode 

And now I am writing plugin. First I inherit from this interface this class:

Qt Code:
  1. class ProgramViewer : public QObject, PluginInterface
  2. {
  3. Q_OBJECT
  4. Q_INTERFACES(PluginInterface)
  5.  
  6. public:
  7. ProgramViewer();
  8. virtual ~ProgramViewer();
  9. virtual QString name() const;
  10. virtual Menu* menu() const;
  11. private:
  12. QString pluginName;
  13. };
To copy to clipboard, switch view to plain text mode 

Function menu() return Menu object. It inherits from QWidget and have only virtual functions and slots:

Qt Code:
  1. class Menu : public QWidget
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. Menu(){}
  7. ~Menu(){}
  8. virtual void showWindow() const = 0;
  9. virtual void makeConnections() = 0;
  10. public slots:
  11. virtual void readData(QByteArray array) =0;
  12. signals:
  13. virtual void writeData(QByteArray array);
  14. };
To copy to clipboard, switch view to plain text mode 

I have also class which inherits from Menu and this class has other widgets and functions.

Qt Code:
  1. class ProgramViewerMenu : public Menu
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. enum DataToSend
  7. {
  8. NewImage = 1,
  9. Pixels,
  10. Stop
  11. };
  12. ProgramViewerMenu();
  13. ~ProgramViewerMenu();
  14. void showWindow() const;
  15. void makeConnections();
  16. bool startBroadcasting();
  17. bool stopBroadcasting();
  18. QByteArray* takeShot(WId id);
  19. QByteArray* changePixels(QImage oldOne, QImage newOne);
  20. public slots:
  21. void readData(QByteArray array);
  22. void broadcasting();
  23. void capture();
  24. void refreshList();
  25. signals:
  26. void writeData(QByteArray array);
  27. private:
  28. QLabel *title;
  29. QPushButton *broadcast;
  30. QPushButton *refresh;
  31. QGridLayout *grid;
  32. QListWidget *list;
  33. QTimer *timerRefresh;
  34. QTimer *timerBroadcast;
  35. QImage screen;
  36. WId id;
  37. bool isBroadcasting;
  38. };
To copy to clipboard, switch view to plain text mode 

In some functions of this class I want to emit writeData(QByteArray) signal which is connected in the first class. But I ve got this error:
In function `ZN17ProgramViewerMenu11qt_metacallEN11QMetaObject 4CallEiPPv':
In function `ZN17ProgramViewerMenu11qt_metacastEPKc':
undefined reference to `Menu::qt_metacall(QMetaObject::Call, int, void**)'
undefined reference to `Menu::qt_metacast(char const*)'

I do not know whats wrong. I am not sure about those virtual functions, signals and slots and also I do not know if it is possible to connect something to plugin. Can anybody solve this? Thanks.

Sorry about my english.