PDA

View Full Version : GridLayout with GraphicsWidget - problem with specific example



Asperamanca
3rd November 2010, 09:47
Hi all,

I am using QGraphicsWidgets in a QGraphicsGridLayout. In general, it works, but in one specific aspect, it does not behave as I expect (see screenshots). Can someone help me understand why the layout does what it does? Thanks!

Text in screenshots specifies horizontal size policy only. I'm fine with the vertical layout.

This is what I expect:
http://members.aon.at/legends/temp/qtLayoutsExpected.png

This is what I get:
http://members.aon.at/legends/temp/qtLayoutsActual.png

As you can see, column 2 (with an expanding item) receives only about as much space as the two columns (1 and 3) with "minimum" items. The "minimum" items in columns 1 and 3 definitely have a lower minimum width than shown - they could be shrunk without any problems.

Asperamanca
3rd November 2010, 12:06
I have solved the problem by using the horizontal size policy "Fixed" for the light green items in columns 1 and 3.
It's not quite what I wanted (the items would be able to grow, if necessary), but it'll do for now.

I used to think that leftover space would always go to "Expanding" items first, and then to others, but that does not seem to be the case.