以下成員源於類 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 ().