I want to create QWidget plugins for an application, that implement a certain interface. Those plugins are simply custom views that implement that interface and the main application loads these widgets into the main view.

However, I am not sure how to do this efficiently. I know that the Plugin itself has to be of the form
Qt Code:
  1. class MyPlugin : public QObject, public MyPluginInterface
  2. {
  3. Q_OBJECT
  4. Q_INTERFACES( MyPluginInterface )
  5. ...
  6. };
To copy to clipboard, switch view to plain text mode 

I read that, if I want to actually create a QWidget from this plugin, the interface should simply contain
Qt Code:
  1. class MyPluginInterface
  2. {
  3. ...
  4. QWidget* createWidget(QWidget* parent) = 0;
  5. ...
  6. };
To copy to clipboard, switch view to plain text mode 

And thus there would be another class
Qt Code:
  1. class MyWidget : public QWidget
  2. {
  3. ...
  4. };
To copy to clipboard, switch view to plain text mode 

But how would I let the actual Widget itself interact with the application? Wouldn't I need to make a wrapper function in the plugin for every single function of the interface, so that it is passed to the Widget object?