开发者

How to edit multiline text in cell of QTableWidget?

How to edit cell manually like in Excel:

Alt + Enter -> line break (true break, not simply line break symbol on 开发者_StackOverflow社区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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜