[Interest] Storing complex SQL relations with Qt

Mark Brand mabrand at mabrand.nl
Thu Dec 12 22:33:19 CET 2013


> [Interest] How to insert a new record with generated primary key into a
> QSqlTableModel
> 
> for that. But I've been readin all day long and I can't find a solution on
> how I can initialize a new record with my DataMapper form …

If you're looking for a way for your application to initialize records 
inserted into QSqlTableModel, look at the signal primeInsert. It exposes the 
new record so you can set the values. Also, don't forget to set the generated 
flags in the fields. They control which fields are included in the generated SQL 
statements.

Mark





More information about the Interest mailing list