insertRecord into QSqlTableModel fails, but item appears in QListView
- by Anteru
I got a pretty weird problem with a QSqlTableModel. The underlying SQL Database has a constraint Title UNIQUE. If I add a record which violates the constraint using insertRecord, the call fails (return value is false.) However, the view which uses the model displays the entry -- I have to manually remove it in order to get rid of it.
How can I change this so the view does not get updated when an insertRecord fails? I would have assumed that the view gets only updated if there is really a change ...