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

Markus Franke Franke.M at sebakmt.com
Fri Sep 10 08:53:19 CEST 2010


Hi Tony,

thanks for your reply. My problem is solved now.
I added the labels to the layout by specifying an alignment within the 
layout.

e.g.

GridLayout->addWidget(myLabel, 0, 0, Qt::AlignCenter);

This somehow breaks the sizehint of the label.

However, "GridLayout->addWidget(myLabel, 0, 0)" works perfectly fine.

Best regards,
Markus

qt-interest-bounces at trolltech.com schrieb am 09.09.2010 17:08:03:

> Hi Markus, 
> 
> I'm confused - labels fill the space by default - see attached from 
> designer.  The left label has its text alignment changed to center, and 
> the right label has stylesheet  background: red;   Both labels are in a 
> grid with the default Preferred size policy. 
> 
> Tony.
> 
> 
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [
mailto:qt-interest-bounces at trolltech.com] 
> On Behalf Of Markus Franke
> Sent: Friday, 10 September 2010 00:12
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QLabel fill entire space of a cell of 
QGridLayout

> 
> David Boosalis <david.boosalis at gmail.com> schrieb am 09.09.2010 
15:48:51:
> 
> > Adding it to the grid with Qt::AlignCenter will keep it small. 
> 
> Well, yes. But this is actually the thing which I would like to avoid. 
> The widget should grow in all directions rather than staying small. 
> 
> Any suggestions? 
>  [Anhang "qlabel_in_grid.png" gelöscht von Markus Franke/KMT/SEBA] 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest



"Disclaimer: This message is intended only for the use of the individual 
or entity to
which it is addressed and may contain information which is privileged, 
confidential, proprietary,
or exempt from disclosure under applicable law. If you are not the 
intended recipient or the person
responsible for delivering the message to the intended recipient, you are 
strictly prohibited from
disclosing, distributing, copying, or in any way using this message. If 
you have received this 
communication in error, please notify the sender and destroy and delete 
any copies you may have
received."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100910/18b7f172/attachment.html 


More information about the Qt-interest-old mailing list