ouch...yeah, that was it. That makes a great second post, doesnt it...
So now i have this code to render a document to the screen:
painter->translate(x, y);
document()->setTextWidth(w);
document()->setDefaultFont(painter->font());
do {
c.setBlockFormat(f);
document
()->drawContents
(painter,
QRect(0,
0,w,h
));
painter->translate(x, y);
document()->setTextWidth(w);
document()->setDefaultFont(painter->font());
QTextCursor c(document());
c.movePosition(QTextCursor::Start);
do {
QTextBlockFormat f = c.blockFormat();
f.setLineHeight(h, QTextBlockFormat::LineDistanceHeight);
c.setBlockFormat(f);
} while (c.movePosition(QTextCursor::NextBlock));
document()->drawContents(painter, QRect(0,0,w,h));
To copy to clipboard, switch view to plain text mode
This works perfectly for single-line strings, but not when strings with linebreaks in it have been assigned:
document().setPlainText("aaaaa\nbbbbbbb\ncccccc");
document().setPlainText("aaaaa\nbbbbbbb\ncccccc");
To copy to clipboard, switch view to plain text mode
any idea?
Bookmarks