[Interest] QSqlRelationalTabelModel fails to insert row

norulez at me.com norulez at me.com
Wed May 30 20:47:39 CEST 2012


Hello,

I have two tables (products, customers).
In the subclass of the QSqlRelationalTableModel (customers) i set up the relations.
In the view i use a QSqlRelationalDelegate to get a combobox with the products.

Now, if i add a new product, then I see the product in the combobox.
But if I add a customer, then the new row (insertRows(rowCount(), 1);) isn't added to the database, but the insertRows() function returns true.
I think that the constraint is violated, but I didn't get any errors with lastError().

Did I need to refresh the relations or something else after I add a product, so that the QSqlRelationalTableModel has the new/updated keys?

Thanks in advance

Best Regards
NoRulez



More information about the Interest mailing list