PDA

View Full Version : QGridLayout - specific widh-hight by percentage



elcuco
20th May 2010, 11:58
I need to stick into a QGridLayout several widgets. So far nothing special. The different is that I need to specify the hight/widths by percentage, and that is not really how QGridLayout works.

My idea is to maintain the widths,hights myself and do the layout manually "on resize".

What alternatives do I have?

borisbn
20th May 2010, 13:38
use QBoxLayout::setStretchFactor

elcuco
20th May 2010, 15:15
use QBoxLayout::setStretchFactor

I don't understand. You are telling me to create y horizontal layouts, and then stick those inside another verstical layout (that y+1 layouts) and manage the whole layout myself?

SixDegrees
20th May 2010, 15:18
You'll be much better off and gain a lot of flexibility if you write your own layout manager, instead of placing unmanaged widgets by hand and manipulating their raw positions and sizes.

elcuco
20th May 2010, 15:41
By looking at examples/layouts/dynamiclayouts/ I see that I am looking for:

QGridLayout::setColumnStretch()

QGridLayout::setRowStretch()

elcuco
25th May 2010, 15:56
Lets continue this thread:

Now, I am putting Phonon::VideoWidget() inside the layout, and the size of the "layout" changes according to the content of the Video, instead of the video resize to the content of the layout.

How can I force the Video to be resize to the size of the layout, and not the other way?