只是QFontMetrics::height()
,还是QFontMetrics::height()+QFontMetrics::leading()
?
例如,在此代码中:
painter.drawText(QRect(x, y, 1000, 1000), "line1");
y += lineOffset;
painter.drawText(QRect(x, y, 1000, 1000), "line2");
y += lineOffset;
painter.drawText(QRect(x, y, 1000, 1000), "line3");
lineOffset
的值必须是什么才能使行间隔,如同使用此代码一样:
painter.drawText(QRect(x, y, 1000, 1000), "line1\nline2\nline3");