View Full Version : QTableView overwriting the editor with update

15th July 2010, 07:42
I have a QTableView hooked up to a QAbstractTableModel. The data in the model is updated several times a second. I have one particular column setup for allowing editing. However, whenever the dataChanged signal is sent out indicating that values have changed, the value for EditRole is requested again and whatever you were typing is wiped out. Any thoughts on how to get around this? I need the edit control not to update while it is displaying.

15th July 2010, 07:46
Looks like a version of this has been answered:


15th July 2010, 21:56
I'm wrong. That tells you how to update the edit widget with updated data. That seems to be happening automatically for me and I need it to stop. Any ideas?

15th July 2010, 23:10
In the end, I built my own custom delegate. I have a flag that controls whether setEditorData() sets data on the editor or not. Every time createEditor() is called, it sets the flag to true. The next time setEditorData() is called, it will set the data on the editor, since it is a new editor, and the set the flag to false in order to stop subsequent value changes to the editor.

If there is an easier way, I'd love to know it.