I use a QPlainTextEdit
for a code editor that also shows line numbers.
But when I press shift+return
a the editor makes a break, but the line number don't increases.
I think in html it would just be a <br/>
instead of a new <p>
tag...
Have a look at the screenshot...
You should probably be using QTextEdit since this is rich text we're talking about.
Override virtual void keyPressEvent ( QKeyEvent * e )
. You can call QTextEdit::keyPressEvent
in the implementation to delegate non-special cases.