以下成员源于类 QFontMetricsF 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。
(obsolete)
qreal
|
width (const QString & text ) const |
(obsolete)
qreal
|
width (QChar ch ) const |
此函数已过时。提供它是为使旧源代码能继续工作。强烈建议不要在新代码中使用它。
返回字符宽度 (以像素为单位) 按给定 text .
注意,此值为 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 ().