PDA

View Full Version : Simple layout problem



Kaluss
27th July 2014, 10:31
Hello,
got some small problem with layout on widgets.
I know it's probably is very simple, but I couldn't find right answer.

10527

How to stretch those buttons on whole surface of parent widget and keep them in the same sizes?

Anyone knows?

BR
Tomek

anda_skoa
27th July 2014, 10:39
If you are adding them in code, pass the same non-zero value to the stretch argument of the layout's addWidget() call.
If you are adding them in designer, change the size policy to Expanding or MinimumExpanding

Cheers,
_

Kaluss
27th July 2014, 11:07
Hi,
it doesn't work, because I already add them from the cod with non-zero value and is the same situation when i put 1 for all or 100 for all.

this->hboxBottomMenu->addWidget(newd,1,Qt::AlignHCenter);

Added after 19 minutes:

My bad. When I deleted Qt::AlignHCenter it looks much better, but still i got some gaps between buttons ;/

anda_skoa
27th July 2014, 12:03
Gaps between child widgets could be a matter of the layout's spacing. See QLayout::setSpacing().

Cheers,
_