I've subclassed QAbstractTableModel and overrode the flags() method so that some of the table cells are editable. The problem is that when I start editing, the existing cell value is erased. I would like to initially have the existing cell value selected. How can I do this?
Asked
Active
Viewed 2,648 times
1 Answers
12
The solution is to handle Qt::EditRole when overriding data(). I was previously only handling Qt::DisplayRole.

bdforbes
- 1,486
- 1
- 13
- 31
-
1You could also use a delegate and set it in `setEditorData`. – eric Oct 11 '15 at 02:16