How to insert new record in a QSqlRelationalTableModel
-
Are you sur the mapper is valid ?
Why is it not part of your dialog rather than passed around ? -
Check the current index.
-
Your record is empty - so what's your db structure. Does it allow NULL values, has it a PK?
-
The table does have a primary key.
The record gets inserted in the database, so I guess it allows NULL values. -
This post is deleted!
-
I want to use it in the child for inserting a new record. mx player for pc mxplayer
-
The logic should be the other way around.
Use the dialog to get the data from your application user. Then create the record based on the data you extract from the dialog.
This will also allow you to properly handle cancellation of the dialog. Otherwise you may end up with empty rows in the database that you will need to remove because you added it too early in your business logic.