5
votes

I have a few widgets in a main window. enter image description here i want the user to be able to resize the widgets inside the window as they please, just like how one would resize the main window. Do I have to make a layout container to enable this? or ....layout? Buh the layout contains are static once the window is rendered. In the picture the three widgets should be enable with resizing such that the user can drag their sides/corners to expand or minimize the widget size.

1
Do you mind if I ask what the use scenario is? Just curious; it sounds unique.Dave Mateer

1 Answers

8
votes

One thing you could do is to use some QSplitter's though it isn't directly as nuanced as you pointed out. Have a look at the image (you can drag the handles):

enter image description here

Another thing is to place the widgets using absolute coordinates and then detect when the cursor is clicked and dragged on the "edge". Then you calculate how much it should be resized and actually resize the widget according to its position.

You could also have a look at the QMdiArea and then add your widgets using addSubWindow() where you also set the window flags.