I have a QTextEdit with many lines and a vertical scrollbar. I want the vertical scrolling to always scroll full lines (as for example Windows Notepad does).
Right now, it has the default behavior of scrolling by pixels and not lines, so it's possible to scroll into the middle of a line for example, which I don't want to happen. Example of the undesired behavior:
Any suggestions how to do this?
I'll answer my own question as I managed to solve it, at least for my usecase.
It turns out this is exactly what QPlainTextEdit
was meant to do, so switching to it from QTextEdit
was all that was needed.