[SOLVED]QPlainTextEdit scroll to the bottom
-
wrote on 17 Jan 2013, 12:51 last edited by
Hi everyone,
I have qplaintextedit and i use insertplaintext method to add some info to qplaintextedit. But i want it to scroll automatically to the last inserted string (bottom).How can i do that?
Thanks in advance.
-
wrote on 17 Jan 2013, 13:38 last edited by VRonin
Just use the setValue function of the vertical scrollbar.
Something like:
MyTextEdit.verticalScrollBar()->setValue(MyTextEdit.verticalScrollBar()->maximum());
-
wrote on 17 Jan 2013, 13:42 last edited by
Hi,
Call "ensureCursorVisible()":http://qt-project.org/doc/qt-4.8/qplaintextedit.html#ensureCursorVisible on your text edit after insertion. Remember to call "setCenterOnScroll(true)":http://qt-project.org/doc/qt-4.8/qplaintextedit.html#centerOnScroll-prop when initializing.
-
wrote on 17 Jan 2013, 13:48 last edited by
[quote author="tilsitt" date="1358430137"]Hi,
Call "ensureCursorVisible()":http://qt-project.org/doc/qt-4.8/qplaintextedit.html#ensureCursorVisible on your text edit after insertion. Remember to call "setCenterOnScroll(true)":http://qt-project.org/doc/qt-4.8/qplaintextedit.html#centerOnScroll-prop when initializing.[/quote]
thank you. ensureCursorVisible() solved this.
1/4