[Qt-interest] QLabel wrap anywhere
Eric Clark
eclark at ara.com
Wed Aug 18 17:03:01 CEST 2010
Jordan,
Try using the QFontMetrics::width() or the QFontMetrics::boundingRect().width() functions. One of these should give you what you need.
Thanks,
Eric
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Jordan Upham
Sent: Wednesday, August 18, 2010 9:53 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] QLabel wrap anywhere
Hi,
I'm looking for a way to wrap a QLabel anywhere and not just on line breaks. I know this is possible with QTextEdits and I have thought about just using those instead of QLabels where I need this behavior but I am running on a mobile device and I am worried about performance of this. Is there a way to figure out how much text of a given string will fit in a given width? I'm thinking it is probably possible with QFontMetrics but I'm not sure.
Thank You,
Jordan Upham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100818/d3bd4cb6/attachment.html
More information about the Qt-interest-old
mailing list