4
votes

I display some rich text contents using a subclass of QTextEdit.

Some editors - especially code editors & IDEs offer a possibility to scroll beyond the last line all the way until the last line gets to the top of the view.

I'd love to be able to do the same thing using QTextEdit. Is this somehow possible? I've been reading the doc but could not find anything.

Thank you.

1
After seeing there no built-in way to do this, I have worked around the issue by programatically appeding extra lines to the documents. It's not exactly elegant, but it works and it the user won't mind, because the edit is readonly anyway. (In a readwrite text edit this would probably not work very well.) - kralyk

1 Answers

0
votes

I never had used QTextEdit that way, but maybe you can solve your problem with scrollToAnchor(QString arg) (which ensure the 'arg' presented in text will be visible), or ensureCursorVisible().