[Interest] QSqlRelationalTabelModel fails to insert row

NoRulez norulez at me.com
Fri Jun 1 17:46:35 CEST 2012


Update: A custom INSERT call with QSqlQuery works in the subclass, but I didn't find out why the insertRows() function doesn't work as expected.

Best Regards

Am 30. Mai 2012 um 20:47 schrieb norulez at me.com:

> 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
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120601/13cd69d3/attachment.html>


More information about the Interest mailing list