I would like to automatically scroll to the top in a QPlainTextEdit widget after put in some text. How can I realize that?
myTextEdit -> moveCursor (QTextCursor::Start) ;
myTextEdit -> ensureCursorVisible() ;
As QTextEdit
inherits from QAbstractScrollArea
, you can move its scrollbars:
QScrollBar *vScrollBar = yourTextEdit->verticalScrollBar();
vScrollBar->triggerAction(QScrollBar::SliderToMinimum);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With