PDA

View Full Version : Shape Changing window? (how to resize the layout/widget/mainwindow?) (thumbnail)



BillGates
18th January 2011, 16:59
How can i fixate the size and position of a widget in a layout, and the size of the layout(parent-widget) ?

I try to mimic a shape changing dialog window (with a More>> -type button).

I have a hidden groupBox placed at the bottom of the layout(dialog) and when i hide() it, the widgets "on top" of it, slide down occupying all the Dialog.

I have created two sublayouts(one containing the top widgets) and one containing the bottom groupBox. They are both included with a .addLayout(lay_top) .addLayout(lay_bottom) into a main VBoxLayout (setLayout in the myDialog constructor). The top-layout contains a label + a button + a textedit. When i click the button, a slot toggles hide()/show() on the groupBox.

What I want is :

Step 1. "Fix" the position (and size) of top layout.
Step 2. hide() bottom groupBox widget (which is in the bottom layout)
Step 3. Shrink-resize the size of the dialog (preferably to whatever I want but still displays top-layout)
Step 4. Now let the widgets in top-layout hog all the space they want (in case the user resizez the dialog window using the mouse)


PS: i have tried this using a widget directly set as central in MainWindow but it behaves differently than a Dialog Window.

Attached Dialog shown here "sliding/spilling" down:
577757765778