views:

50

answers:

1

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.

+2  A: 

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.

cnebrera
This doesn't answer more important part of question - how to add line break. When I enter edit mode all breaks temporarily become blanks, what is very unconvenient.
DSblizzard
I dont truly understand by true break. You mean having text into the cell but starting one line down? But without using escape character?
cnebrera
No, no, see edit of question.
DSblizzard
Have you tried to get the cursor from the edditing object and insert the linespace special character there?
cnebrera