PDA

View Full Version : Cloning widgets for reuse



JovianGhost
11th May 2010, 01:55
I have a GUI app that constantly changes its look based on user interaction. In particular, I have two areas, each of which will be replaced by a particular widget (actually a groupbox containing multiple fields) depending on the user's selection. Each of these areas *might* potentially contain the same widget, although different instances, so their members can be accessed separately.

Is it possible to create a "widget template" from which I can create multiple instantiations, and use them wherever I wish? The alternative would be to create two of every possible groupbox + fields, which I'm not too thrilled about doing, since I could potentially have a lot of them.

Thoughts?

tbscope
11th May 2010, 05:54
Create your custom widgets, example:
A QWidget containing a groupbox, checkboxes, layouts, ...

Then use a stacked widget to show all your custom widgets.

JovianGhost
13th May 2010, 12:57
Using a stacked widget doesn't solve my problem of having to reuse the widgets on one page in another page of the other stacked widget.