[Interest] QDataWidgetMapper somehow erases values in QSqlRecord

Knut Krause knut.krause at lagom.de
Thu Dec 26 19:56:18 CET 2013


Hi. I'd like to write crash safe SQL code. In this simple form 
http://pastebin.com/yqyGDtpt I'm able to insert values using the 
QDataWidgetMapper.

If I set the model (QSqlTableModel) to AutoSubmit everything works fine but 
this leads to increasing primary keys if the user hits the cancel button since 
the  row has actualy been inserted in the database and if the application 
would crash in the dialog the row would reamain.

So I set the model to ManualSubmit. The current code inserts a new row, fills 
the row in the table with the values as you're typing (so the mapper works fine 
I think) but if you actually hit submit you end up with a blank row and just a 
valid ID. Anyone an idea where the other values get erased?

regards


Knut



More information about the Interest mailing list