I have a KTextEdit filled with some text.
When I put a lot of text, the KTextEdit will automatically scroll to the end (obviously).
My question is, how can I go to the beginning (namely the first line of KTextEdit)?!?
It looks like you are using
QTextCursor cursor = edit->textCursor(); cursor.setPosition(0); edit->setTextCursor(cursor);
Not tested but looks great. Found another, shorter way:
edit->moveCursor(QTextCursor::Start);
The simplest way I can think of is:
KTextEdit *kte; ... kte->append("some huge text"); kte->verticalScrollBar()->setValue(0);