PDA

View Full Version : How to shrink a dialog



lotek
10th June 2011, 23:22
Hello,

I have dialog with a widget in a layout. The widget can be set as visible or not (setVisible(bool) method.
After setting the widget visible the dialog grows - that is correct, but after setting widget invisible the dialog does not shrink back. Is there any possibility to make the dialog shrinking automatically?
( apart from remembering of the original size and resize)

Thanks for your help,

regards,

me :)

Santosh Reddy
11th June 2011, 01:07
Yes, it is possible to do so this way. When the dialog is empty, what is the size you want the dialog to be? (say w, h), use setMaximumSize(w, h) on the dialog, and then add your widgets to the dialog, the dialog grows, then when you hide the widget the dialog will shrink the size set by you. Remember to call adjustSize() on the dialog after setVisible(false) on the widget.

wysota
11th June 2011, 10:10
Expanding dialog

lotek
11th June 2011, 10:49
Thank You,

Both solutions work perfectly!