How to program scrollbar to jump to bottom/top in case of change in QPlainTextEdit or QTextEdit area?

前端 未结 5 1168
失恋的感觉
失恋的感觉 2020-12-10 13:29

How to program scrollbar to jump to bottom/top in case of change in QPlainTextEdit or QTextEdit area? It looks like it doesn\'t have any controlling function.

5条回答
  •  有刺的猬
    2020-12-10 14:04

    Here I am posting my Solution as above solution dint work in my case.

    I want to get the cursor at the beginning of QTextbrowser.

    By using QTextEdit::setTextCursor, you can move the visible cursor where you want:

         // Go to beginning
         QTextCursor textCursor = ui->textBrowser->textCursor();
         textCursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor,1);
         ui->textBrowser->setTextCursor(textCursor);
    

    Hope, it will help to some one and save their precious time.

提交回复
热议问题