Custom plugin for a layout
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.
Thanks,
Cristian
Re: Custom plugin for a layout
Quote:
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:
Code:
if(feature=="xxx"){
MyLayout *l = new MyLayout(p);
w->setLayout(l);
return w;
}
}
Re: Custom plugin for a layout
Quote:
Originally Posted by wysota
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:
Code:
if(feature=="xxx"){
MyLayout *l = new MyLayout(p);
w->setLayout(l);
return w;
}
}
This worked, thank you!
Cristian