以下成员源于类 QFontMetrics are part of the Qt compatibility layer. We advise against using them in new code.
| QRect | boundingRect (const QString & text , int len ) const |
| QRect | boundingRect (int x , int y , int w , int h , int flags , const QString & text , int len , int tabStops = 0, int * tabArray = 0) const |
| QSize | size (int flags , const QString & text , int len , int tabStops = 0, int * tabArray = 0) const |
使用 boundingRect () function in combination with QString::left () 代替。
例如,若有代码像
QRect rect = boundingRect(text, len);
可以把它重写成
QRect rect = boundingRect(text.left(len));
使用 boundingRect () function in combination with QString::left () 和 QRect constructor instead.
例如,若有代码像
QRect rect = boundingRect(x, y, w, h , flags, text, len,
tabStops, tabArray);
可以把它重写成
QRect rect = boundingRect(QRect(x, y, w, h), flags, text.left(len), tabstops, tabarray);
使用 size () function in combination with QString::left () 代替。
例如,若有代码像
QSize size = size(flags, str, len, tabstops, tabarray);
可以把它重写成
QSize size = size(flags, str.left(len), tabstops, tabarray);