[Qt-interest] QFontMetrics question

amulya rattan talk2amulya at gmail.com
Fri May 7 12:28:46 CEST 2010


This email contained a .zip file attachment. Raytheon does not allow email attachments that are considered likely to contain malicious code. For your protection this attachment has been removed.

If this email is from an unknown source, please simply delete this email.

If this email was expected, and it is from a known sender, you may follow the below suggested instructions to obtain these types of attachments.

+ Instruct the sender to enclose the file(s) in a ".zip" compressed file, and rename the ".zip" compressed file with a different extension, such as, ".rtnzip".  Password protecting the renamed ".zip" compressed file adds an additional layer of protection. When you receive the file, please rename it with the extension ".zip".

Additional instructions and options on how to receive these attachments can be found at:

http://security.it.ray.com/antivirus/extensions.html
http://security.it.ray.com/news/2007/zipfiles.html

Should you have any questions or difficulty with these instructions, please contact the Help Desk at 877.844.4712

---

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



More information about the Qt-interest-old mailing list