
Originally Posted by
cocheci
Is it possible to create a designer plugin for a custom "widget" that does not derive from QWidget? I have a custom layout class that derives from QBoxLayout, and I would like to display it in designer, just like I do with my custom widgets. The problem is that the createWidget() method of the plugin class returns a QWidget*, but the layout does not derive from QWidget.
No, it has to be QWidget. You can cheat a little though and return an empty QWidget just with your layout set (just remember the widget has to be marked as a container).
I don't remember the exact syntax, but it's something like this:
if(feature=="xxx"){
MyLayout *l = new MyLayout(p);
w->setLayout(l);
return w;
}
}
QWidget * plugin::createWidget(const QString &feature, QWidget *p){
if(feature=="xxx"){
QWidget *w = new QWidget(p);
MyLayout *l = new MyLayout(p);
w->setLayout(l);
return w;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks