Originally Posted by
jpn
Perhaps you could lay the text by hand with help of
QTextLayout.
I tried QTextLayout and got the right alignment.But the Item does not display when I am typing.As soon as I press Enter,the Item displays the line that I just input at one moment.And the textcursor does not flash.I guess it may be the item refresh region is not my layout region.Can you give me some advise?
//Here is some code in paint
textLayout.beginLayout();
while (1) {
if (!line.isValid())
break;
line.setLineWidth(200);
line.
setPosition(QPoint(0,height
));
height += (int) line.height();
}
myheight+=height;
textLayout.endLayout();
textLayout.
draw(painter,
QPointF(0,myheight
));
//Here is some code in paint
textLayout.beginLayout();
while (1) {
QTextLine line = textLayout.createLine();
if (!line.isValid())
break;
line.setLineWidth(200);
line.setPosition(QPoint(0,height));
height += (int) line.height();
}
myheight+=height;
textLayout.endLayout();
textLayout.draw(painter,QPointF(0,myheight));
To copy to clipboard, switch view to plain text mode
Bookmarks