2 Attachment(s)
How do you get a child widget to resize with its parent?
I have two custom widgets: Graph and Paint, I want to overlay the Paint widget on the Graph widget.
I've made Paint a child of Graph and I have a layout assigned to the MainWindow; This works like I want it to until I change the size of the main window, the Graph adjusts, but Paint does not (see Figure 1). If I add a layout to the parent Graph as well then Paint ends up in the corner and still doesn't stretch appropriately (see Figure 2).
I've been looking around, but haven't been able to find out how to adjust this, I would prefer a method of fixing it in the designer if possible. Thank you!
Figure 1:
Attachment 12092
Figure 2:
Attachment 12093
Re: How do you get a child widget to resize with its parent?
If you have no layout, then you need to resize manually.
If you have a layout, the widget needs to tell the layout that it can expand.
See the widget's sizePolicy property.
Cheers,
_