PDA

View Full Version : howto expand frame to maximum size



masoroso
19th April 2006, 11:14
Hi all,

I have a layout question.

I've made a form and put a QToolbox and a QFrame on it. I organized these two widgets by putting them into a QHBoxLayout. Now I want the toolbox on the left side to be of a static witdh so I put the sizePolicy to Fixed (horizontal) and Expanding (vertical). The right frame should occupy the rest of the space (Expanding, Expanding).

This seems to be ok because if I resize the layout box it behaves like I hoped (and expected) it would :-)

But now to the question.. how can I make the layout use the entire window? Forgive me that I fall back on my Delphi experience but in Delphi you had the alignement -> alClient option which is exactly what I would like to achieve here.

Thanks in advance!
Rob

jpn
19th April 2006, 11:46
QLayout::setMargin() (http://doc.trolltech.com/4.1/qlayout.html#margin-prop)
QLayout::setSpacing() (http://doc.trolltech.com/4.1/qlayout.html#spacing-prop)

masoroso
19th April 2006, 12:15
Sorry but that didn't help me..

I designed the form in QtDesigner and there is no possibility to set the name of the layout (so to later retrieve it) or to set the margin or spacing property to -1 :confused:

this is part of the ui-file



<layout class="QHBoxLayout" >
<property name="margin" >
<number>1</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
.. (widgets)
</item>

</layout>


Should I hack the ui generated file? I guess not. But then what? I do not know the name of the layout so I can't just use code in the constructor like layoutName.setMargin(-1) or something like that.

Any further help?

jpn
19th April 2006, 12:20
Check the last section ("Layout") of the Property Editor, when the window/widget (for which the layout is set) is selected.

masoroso
21st April 2006, 09:40
Check the last section ("Layout") of the Property Editor, when the window/widget (for which the layout is set) is selected.
I did.. but there is no possibility to set either of these values to -1 in QtDesigner. :confused: