[Qt-interest] Customized Label

Kimmo Viitanen kviitanen at gmail.com
Mon Aug 9 11:16:16 CEST 2010


> When  the text changes with the click event, sometimes some of the text get
> cropped.


> Do i have to over-ride the sizeHint() so  that the label gets expanded
> dynamically to fit the text inside the label.

One way could be to use QFontMetrics::boundingRect or
QFontMetrics::width() to retrieve the width of the string
and then set the label size explicitly based on this width.



Kimmo



More information about the Qt-interest-old mailing list