0

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

JuanDeLosMuertos
  • 4,532
  • 15
  • 55
  • 87

2 Answers2

1

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
  • 496,577
  • 130
  • 894
  • 1,212
0

The simplest way i can think of is:

KTextEdit *kte;
...
kte->append("some huge text");
kte->verticalScrollBar()->setValue(0);
user11323
  • 361
  • 1
  • 3
  • 7