1. QLabel::fontMetrics().width(QString s): 获取字符串s的总像素宽度。
Returns the width in pixels of the first len characters of text. If len is negative (the default), the entire string is used.
Note that this value is not equal to boundingRect().width(); 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().
2. QLabel::fontMetrics().height(): 获取字体的高度。
Returns the height of the font.
This is always equal to ascent()+descent()+1 (the 1 is for the base line).
See also leading() and lineSpacing().
3. QLabel::fontMetrics().lineSpacing(): 获取字体的高度,包括文字的实际宽度和行距。
4. QLabel::fontMetrics().leading(): 行间距
Returns the leading of the font.
This is the natural inter-line spacing.
See also height() and lineSpacing().
其他函数参见QT 的 QFontMetrics Class Reference
Returns the distance from one base line to the next.
This value is always equal to leading()+height().
See also height() and leading().