Take a look at Qt's plugin system. A common mistake is to try to inherit the plugin class from QWidget. Instead of that, you should define a function which creates and returns a widget when asked:
Qt Code:
  1. class PluginInterface
  2. {
  3. public:
  4. virtual ~PluginInterface() {}
  5.  
  6. virtual QWidget* createWidget(QWidget* parent = 0) const = 0;
  7. };
To copy to clipboard, switch view to plain text mode