[Qt-interest] How to alter QVBoxLayout widget spacing ?

Sonic get.sonic at gmail.com
Wed Feb 17 15:30:20 CET 2010


On 02/17/2010 07:37 PM, Alexandre Beraud wrote:
> Hi,
>
> I am surprised that you couldn't fix your problem with
> QLayout::setContentsMargins(). Make sure that you set small margin
> values (top, bottom, left, right) for all your layouts.
>
>    
If there's more than enough space available, my experience is that 
QLayout will lay out items with equal spacing (unless you meddle with 
the stretch factors and stuff). Setting the contents margins won't help 
here, IMHO.

What I've done as a work-around is to use a dummy background widget as 
the widget for the scroll area with QSrcollArea::setWidget().
Then apply the QVBoxLayout to this dummy widget and then resize this 
widget to be just big enough to hold the number of ParagraphRow objects.

I know it's a bit ugly, but that's how I made it worked :-(

regards,

Syam



More information about the Qt-interest-old mailing list