Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set initial text when editing a QTableView cell

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?

like image 912
bdforbes Avatar asked May 08 '10 05:05

bdforbes


1 Answers

The solution is to handle Qt::EditRole when overriding data(). I was previously only handling Qt::DisplayRole.

like image 140
bdforbes Avatar answered Oct 15 '22 08:10

bdforbes