Hello,

i'm working on a program which has a QMdiArea. The QMdiSubWindows are QPlugins which can be loaded during runtime.

This is the current plugin Interface:

Qt Code:
  1. #ifndef INTERFACE_H
  2. #define INTERFACE_H
  3.  
  4. #include <QtPlugin>
  5.  
  6. class PluginInterface
  7. {
  8. public:
  9. virtual ~PluginInterface() { }
  10.  
  11. virtual QString getName() = 0;
  12. virtual QWidget* getWidget() = 0;
  13.  
  14. };
  15.  
  16. Q_DECLARE_INTERFACE(PluginInterface, "foo.demo.PluginInterface/1.0")
  17.  
  18. #endif
To copy to clipboard, switch view to plain text mode 

in getWidget() i load or create a widget and than the main program can get the widget with getWidget() and put it into a QMdiSubWindow.

So far it works quite well.

But now i want to have some communication between the plugins. E.g. if i press a button in one plugin something should happen in the other plugin.

I have tried to give the plugins a reference to their communication partner when i load a plugin. But it doesn't work. I think the problem was that i always casted the plugins down to qwidget and than within the plugin again up to foobar-plugin but than of course all the special foobar-plugin methods are lost due the "down-cast". But the main program doesn't know about all possible plugin classes. So i'm stuck and don't know how to solve the problem.

Can you give me some hints how i could achieve this?

Thanks!