它只是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");