Hi,
is there a way to control the space between lines in a QTextEdit Control?
or some trick for having a larger space using fonts?
Thanks in advance
Bye
Hi,
is there a way to control the space between lines in a QTextEdit Control?
or some trick for having a larger space using fonts?
Thanks in advance
Bye
The only thing I found in the docs is:
But I don't know how you can influence ascent() and descent(), maybe it is a resulting thing from the text layout object params.qreal QTextLine::height () const
Returns the line's height. This is equal to ascent() + descent() + 1.
See also ascent() and descent().
Oh wait a minute, you don't want to change the line hight, but the space between the lines rihgt?
The look here:
http://doc.trolltech.com/4.1/qtextlayout.html
Here's some pseudo code that presents the layout phase:
int leading = fontMetrics.leading();
int height = 0;
qreal widthUsed = 0;
textLayout.beginLayout();
while (1) {
QTextLine line = textLayout.createLine();
if (!line.isValid())
break;
line.setLineWidth(lineWidth);
height += leading;
line.setPosition(QPoint(0, height));
height += line.height();
widthUsed = qMax(widthUsed, line.naturalTextWidth());
}
textLayout.endLayout();
Thanks for the suggestion,
I'm trying to figure it out how to use it in a QtextEdit
thanks again
bye
Bookmarks