scrolling KTextEdit to start
Question
I have a KTextEdit, filled with some text.
When I put lots of text, the KTextEdit will be scrolled automatically to the end (obviously).
My question is: how can I scroll to the start (viz to the first line of the KTextEdit) ?!?
Solution
Looks like you use
QTextCursor cursor = edit->textCursor();
cursor.setPosition(0);
edit->setTextCursor(cursor);
Not tested, but looks fine. Found another, shorter way:
edit->moveCursor(QTextCursor::Start);
OTHER TIPS
The simplest way i can think of is:
KTextEdit *kte;
...
kte->append("some huge text");
kte->verticalScrollBar()->setValue(0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow