QFontMetrics :: leading () returns 0
Why does the following function return 0? (My environment: Windows Vista, vC ++ 9, Qt4.5)
int func()
{
QPushButton button("Blah blah");
QFontMetrics fm = button.fontMetrics();
return fm.leading();
}
The call "fm.height ()" returns reasonable results (16px in my case).
Calling "fm.lineSpacing ()" returns the same result as "fm.height ()".
Calling "fm.boundingRect (QRect (), 0," first line \ n second line \ n third line "). Height ();" returns 16 * 3, i.e. again line spacing not included in the result ...
Is this a misuse on my part or something else?
source to share
According to the docs, lineSpacing()
always equals height()
+leading()
height()
always equal ascent()+descent()+1
(1 for baseline).
From here, the leading is "the vertical space between lines of text - the name comes from a physical piece of lead that was previously used in the mechanical printing process to separate lines of text
So what font are you using and does it use zero size?
source to share