![Quote](images/misc/quote_icon.png)
Originally Posted by
VireX
I tried doing this to keep the cursor at the end of all the TEXT. However, this did not work:
qtxtbrowser->textCursor().clearSelection();
qtxtbrowser
->textCursor
().
movePosition(QTextCursor::End);
qtxtbrowser->insertHtml(qsData+"<br>");
qtxtbrowser->textCursor().clearSelection();
qtxtbrowser->textCursor().movePosition(QTextCursor::End);
qtxtbrowser->insertHtml(qsData+"<br>");
To copy to clipboard, switch view to plain text mode
That is modifying a copy. It should be done in this way:
cursor.clearSelection();
qtextbrowser->setTextCursor(cursor); // <--
qtxtbrowser->insertHtml(qsData+"<br>");
QTextCursor cursor = qtxtbrowser->textCursor();
cursor.clearSelection();
cursor.movePosition(QTextCursor::End);
qtextbrowser->setTextCursor(cursor); // <--
qtxtbrowser->insertHtml(qsData+"<br>");
To copy to clipboard, switch view to plain text mode
By the way, Qt 4.2 introduces a new convenience method for moving the cursor. You could try something like this:
qtxtbrowser->insertHtml(qsData+"<br>");
qtxtbrowser->moveCursor(QTextCursor::End);
qtxtbrowser->insertHtml(qsData+"<br>");
To copy to clipboard, switch view to plain text mode
Bookmarks