tags:

views:

40

answers:

2

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) ?!?

A: 

The simplest way i can think of is:

KTextEdit *kte;
...
kte->append("some huge text");
kte->verticalScrollBar()->setValue(0);
+1  A: 

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);
Johannes Schaub - litb
yes, the second way works perfectly :D
Giancarlo
well you will find it here: http://doc.trolltech.com/4.4/qtextedit.html
Johannes Schaub - litb