Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QPlainTextEdit - change shift+return behaviour

Tags:

qt

qt4

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...

Have a look at the screenshot

like image 655
appsthatmatter Avatar asked Dec 08 '25 03:12

appsthatmatter


1 Answers

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.

like image 114
spraff Avatar answered Dec 11 '25 02:12

spraff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!