PDA

View Full Version : Plugin with widget



Misenko
29th August 2008, 17:45
Hi

I need to make a plugin which when I load some widget will be added to main window.

For example I have widget with label and button with some functions, signals, slots etc.
And I want to build this widget as a plugin, dll file, and after loading in another application I want this widget to show there.
For example on other widget.

How can I do that? I have never worked with plugins before :o

PS: Sorry about my english...

jpn
29th August 2008, 20:55
Take a look at Qt's plugin system (http://doc.trolltech.com/4.4/plugins-howto.html#the-lower-level-api-extending-qt-applications). 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:


class PluginInterface
{
public:
virtual ~PluginInterface() {}

virtual QWidget* createWidget(QWidget* parent = 0) const = 0;
};