When I press the ADD button in my program I end up in the tableview edit mode and there I enter some text in the first two fields out of three but then I press ESC key which then puts me back in the tableview list and the new record seems to have been discarded which should be correct behavior. The problem is that the record is actually stored in the DB but I have to refresh the tableview to show it. Is there anyway I can catch this "ESC keypress" in the model setData method? Something like if (row edit is cancelled) then don't save it to DB else return QSqlTableModel::setData(index, value, role)? I´m very new to qt model/view programming but have some minor understanding of the concept.