[Qt-interest] QLabel fill entire space of a cell of QGridLayout

Oszkar Ambrus oszkar.ambrus at deri.org
Thu Sep 9 14:22:26 CEST 2010


Hi Markus,

On 09/09/10 12:33, Markus Franke wrote:
>
> Dear all,
>
> I have a custom widget which is managed by a QGridLayout. I want to put
> several QLabel's with text into the grid layout.
>
> However the labels are only scaled as big as to fit the text which is
> inside.
> How can I achieve that the QLabel's are expanded to fill the entire
> available space of one cell of the grid layout?
>
> I tried to play around with the size policy of the QLabel's but so far I
> didn't succeed.

You could try creating a QHBoxLayout, to which you add your label and a 
stretch.
Then add the QHBoxLayout to the grid layout's cell.

Regards,
-- 
Oszkár Ambrus

"Whoever believes in the Son [Jesus Christ] has eternal life"
(John 3:36)




More information about the Qt-interest-old mailing list