The following members of class QFontMetricsF are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
Returns the width in pixels of the characters in the given text.
Note that this value is not equal to the width returned by boundingRect().width() because boundingRect() returns a rectangle describing the pixels this string will cover whereas width() returns the distance to where the next string should be drawn.
See also boundingRect().
This is an overloaded function.
Returns the logical width of character ch in pixels. This is a distance appropriate for drawing a subsequent character after ch.
Some of the metrics are described in the image to the right. The central dark rectangles cover the logical width() of each character. The outer pale rectangles cover the leftBearing() and rightBearing() of each character. Notice that the bearings of "f" in this particular font are both negative, while the bearings of "o" are both positive.
Warning: This function will produce incorrect results for Arabic characters or non-spacing marks in the middle of a string, as the glyph shaping and positioning of marks that happens when processing strings cannot be taken into account. When implementing an interactive text control, use QTextLayout instead.
See also boundingRect().
As part of the free Business evaluation, we offer a free welcome call for companies, to talk about your requirements, and how the Felgo SDK & Services can help you. Just sign up and schedule your call.
Sign up now to start your free Business evaluation: