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
class MyPlugin
: public QObject,
public MyPluginInterface
{
Q_OBJECT
Q_INTERFACES( MyPluginInterface )
...
};
class MyPlugin : public QObject, public MyPluginInterface
{
Q_OBJECT
Q_INTERFACES( MyPluginInterface )
...
};
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
class MyPluginInterface
{
...
...
};
class MyPluginInterface
{
...
QWidget* createWidget(QWidget* parent) = 0;
...
};
To copy to clipboard, switch view to plain text mode
And thus there would be another class
{
...
};
class MyWidget : public QWidget
{
...
};
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?
Bookmarks