PDA

View Full Version : Layout question



cpuinthebrain
2nd September 2012, 08:47
Hi,

i have a question about the layout in Qt.
Let's say we have a simple QWidget and inside i place for instance two QFrames.I want to layout them horizontally so i use QVLayout.OK, they fill the space proportionally 50% for the first one and 50% for second one.My question is how i can change this for instance 30% to 70% or each of QFrames to have custom size but to be aslo with layout.I use Qt Designer and i need a layout because manually i can't set precisely the widgets.

Zlatomir
2nd September 2012, 16:18
Take the QSizePolicy (http://qt-project.org/doc/qt-4.8/qsizepolicy.html) of the widgets, set horizontal (http://qt-project.org/doc/qt-4.8/qsizepolicy.html#setHorizontalStretch) (or vertical) stretch factor and then set the size policy back to the widget.

Lesiok
2nd September 2012, 17:17
Set layoutStretch to (7,3)