以下成员源于类 QFontMetrics 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。
(obsolete)
int
|
charWidth (const QString & text , int pos ) const |
(obsolete)
int
|
width (const QString & text , int len = -1) const |
(obsolete)
int
|
width (QChar ch ) const |
此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。
Returns the width of the character at position pos in the string text .
The whole string is needed, as the glyph drawn may change depending on the context (the letter before and after the current one) for some languages (e.g. Arabic).
This function also takes non spacing marks and ligatures into account.
此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。
(以像素为单位) 返回宽度对于第一 len 字符的 text 。若 len 为负 (默认),使用整个字符串。
注意,此值为 not 等于 boundingRect ().width(); boundingRect () 返回此字符串将覆盖像素的描述矩形,而 width() 返回应绘制的下一字符串距离。
另请参阅 boundingRect ().
此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。
这是重载函数。
Returns the logical width of character ch 以像素为单位。这是适合绘制后续字符的距离后于 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 () 和 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.
警告: 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 代替。
另请参阅 boundingRect ().