insertRecord into QSqlTableModel fails, but item appears in QListView
Posted
by Anteru
on Stack Overflow
See other posts from Stack Overflow
or by Anteru
Published on 2010-05-21T17:58:02Z
Indexed on
2010/05/21
18:00 UTC
Read the original article
Hit count: 427
qt
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 ...
© Stack Overflow or respective owner