[Qt-interest] QFontMetrics question
amulya rattan
talk2amulya at gmail.com
Fri May 7 12:21:59 CEST 2010
Hi there,
A query regarding QFontMetrics and which api to use for calculating size of
a QString. The size is then used to create an svg out of text string.
However I am not sure whether to go with width() or boundingRect(). In the
attached example, I have used both functions, once with whole string and
once finding whole width as sum of widths of characters in the string. Using
width(), both times(just string and sum of chars in string), the result was
same(206). However, using boundingRect(), the results are different:
1. with whole string : 206(similar to results with width())
2. as sum of char width in string : 150!
Can someone tell me why such a difference is there and which api should i
use if i want to create an svg out of this string?
Appreciate any response.
Thanks,
~Amulya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100507/ca7137ab/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fonts.zip
Type: application/zip
Size: 2661 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100507/ca7137ab/attachment.zip
More information about the Qt-interest-old
mailing list