So, I have a QtGui.QTextEdit
that will be dynamically inserted with plain text based on what the user enters to some other QtGui.QLineEdit
. As the user enters text into the QLineEdit
, the user would at some point in time need to scroll down to see the latest data.
Is it possible to set an auto-scroll to the QTextEdit
(which is just read only, if it matters) so that it is automatically scrolls down to display the latest data entered by the user? If yes, how?
Thanks
when signal QLineEdit::textEdited
is emitted, append the text in QLineEdit
to QTextEdit
, and then:
QTextCursor c = txtedit.textCursor();
c.movePosition(QTextCursor::End);
txtedit.setTextCursor(c);
// txtedit.ensureCursorVisible(); // you might need this also
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.