First let me describe my goal. I have a Qt application that displays a number of toolbar-like floating windows that are sized according to the data the contain, and also resize dynamically when the user requests help or wants to display a graph (see the first set of images for examples). I make use of a number of layout, view, and widget classes to pull this off, but all this has worked well for some time.

table1..png
table1_with_help..png
table1_with_graph.jpg

The problem is that some tables can be too large for some user's laptop screens, and so I wanted to fix this by adding on-demand scroll bars that only appear when the window is too large for the screen in either one or both axes.

After sub-classing QScrollArea to get rid of the silly

Qt Code:
  1. return sz.boundedTo(QSize(36 * h, 24 * h));
To copy to clipboard, switch view to plain text mode 
size clipping that they do in their sizeHint() to artifically limit the maximum hinted size, and instead creating limits that are close to the current screen size, I am able to get my desired result.

table2_with_work&#105.jpg

The problem now is an undesirable side effect: All of my windows are sized correctly after the initial layout process is completed - exactly like the images I have shown above, BUT if the user takes any actions which cause the viewport contents to grow (by turning on the help text for example), the window does not resize like it used to, and instead just adds scrollbars, even though I am no where near my sizeHint() clipping limit that I have set.

table1_with_bad_h&#.png

It would seem that whatever logic is used in the initial layout sizing (which works perfectly) is not the same as what happens when widgets and layouts get resized later. Does anyone know what the culprit is here or where I should look? Trying to debug layout calls really isn't fun...

Colby