PDA

View Full Version : Committing data in QTableWidget with no ENTER



cdonham
1st June 2011, 06:08
I have a QTableWidget with a column containing text.

The user changes the text, but then does not hit <ENTER>. Instead, they go to a menu where they can accept the dialog and go on.

The problem is that the table widget does not take the change unless <ENTER> is pressed. When I call table->text(), it returns the old data. (it operates correctly if the user hits <ENTER> first and then accepts the dialog)

This has to be a common issue, but I can't find any reference to it on the web.
*) I've tried looking for a way to use commitData, but I can't find a way to access the editor.
*) I've also looked for a way to access the uncommitted text, but can't find that either.
*) I thought about implementing my own cellWidget, but when I tried that with QLineEdit, the performance dropped significantly, sorting ceased to function, and it looked like some other issues popped up.
*) I'm thinking about manufacturing a QKeyEvent for an ENTER, but that seems like such a hack.

Thoughts? Thanks.

Chris