Question

How to edit cell manually like in Excel:
Alt + Enter -> line break (true break, not simply line break symbol on the same line)
Enter -> exit from edit mode?

EDIT:
Text in one cell in view mode:
Line1
Line2

Same text in edit mode:
Line1 Line2

Besides, I cannot write newline in cell, I can insert it only by copying.

Was it helpful?

Solution

A easy solution is to subclass QTableWidget and reimplement the keyPressEvent function.

You just need to change the behaviour in the cases you want and call the parent in the ones you don't want to handle.

Have a look at keyPressEvent(QKeyEvent *) method documentation in QWidget doc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top