
Originally Posted by
high_flyer
No.
//in your application code
MyWidget *pWidget = m_pPlugin->createWidget();
if(pWidget){
pWidget->someMethod();
}
//in your application code
MyWidget *pWidget = m_pPlugin->createWidget();
if(pWidget){
pWidget->someMethod();
}
To copy to clipboard, switch view to plain text mode
Well, yeah, I guess it was kind of a stupid question
. I am simply a bit confused on how to implement this the "correct" way. So if I want to create plugins that are independent views in the main application, with which the main application interfaces through a certain interface (i.e. ViewInterface). Would I need to do something like this?
class ViewPlugin
: public QObject,
public ViewPluginInterface
{
Q_OBJECT
Q_INTERFACES( ViewPluginInterface )
...
};
class ViewPlugin : public QObject, public ViewPluginInterface
{
Q_OBJECT
Q_INTERFACES( ViewPluginInterface )
...
};
To copy to clipboard, switch view to plain text mode
class ViewPluginInterface
{
ViewWidget
* createWidget
( QWidget* parent
) = 0;
};
class ViewPluginInterface
{
ViewWidget* createWidget( QWidget* parent ) = 0;
};
To copy to clipboard, switch view to plain text mode
class ViewWidget : public ViewInterface
{
...
};
class ViewWidget : public ViewInterface
{
...
};
To copy to clipboard, switch view to plain text mode
class ViewInterface
: public QWidget{
...
};
class ViewInterface : public QWidget
{
...
};
To copy to clipboard, switch view to plain text mode
In that case, the createWidget function would be the only function of the plugin interface. And I am not sure the inheritance of QWidget works this way?
Bookmarks