[Qt-interest] QLabel wrap anywhere
Ramesh
ramesh.bs at robosoftin.com
Thu Aug 19 06:13:51 CEST 2010
There are two possibilities,
1) You need to set the wordwrap property of Qlablel to true, but the
text gets wrapped only if it have spaces present in it else
It will not.
2)
http://stackoverflow.com/questions/3020868/how-to-determine-the-number-of-ch
arecter-will-fit-to-screen-in-qt
using QFontMetrics <http://doc.qt.nokia.com/latest/qfontmetrics.html> get
the string width in pixels. But its still cumbersome,,
3) If you feel none of the above methods are handy, then you hardcode
it. There are only 3 types of screen resolution you will have,
S60 5th edition phones one resolution, S603rd edition will have another
resolution and business series phones will have its own unique resolution
based on that you categorize and perform the operation.
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Jordan Upham
Sent: Wednesday, August 18, 2010 8:23 PM
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
-----------------------------------------------
Robosoft Technologies - Come home to Technology
Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100819/62fa0676/attachment.html
More information about the Qt-interest-old
mailing list