[Qt-interest] Dynamic Layout Management

Shawn Badger shawnbadger at gmail.com
Mon Dec 28 21:02:14 CET 2009


Hi,

I am running into a problem that I can't seem to find an answer to.
My scenario is simple.  I have a central widget that contains two
child widgets in a horizontal layout, like so:

------------------------------
|         |                           |
|         |                           |
|    1   |            2             |
|         |                           |
|         |                           |
------------------------------

I need the ability to show only widget #1, or #2, or both at the same
time, and have the window grow/shrink accordingly.  When I hide #1 and
then call resize(0,0), the window correctly shrinks to the size of #2.
 And when I show #1, it grows back to the size of #1+#2.  However, if
I hide #2, I cannot get the window to shrink down to the size of #1.
It's like the size hint does not get updated correctly.

Does anyone know how to get the behaviour I am looking for, without
having to force a fixed geometry?

Thanks,
Shawn




More information about the Qt-interest-old mailing list