tags:

views:

28

answers:

0

I've sublassed QSqlRelationalTableModel for one of the tables in my app. Basically I've added custom header data and custom flags so some columns are non-editable. Also a custom setData() function to reject null primary keys. The table's edit strategy is QSqlTableModel::OnRowChange. My app has a button that inserts a new row when pressed and submits the changes in the table to the db (it calls submitAll() and then insertRow()). My basic workflow is: edit a row, push the "new row" button, see that the "*" that was on the row's left turned into a number, so it was submitted.

BUT by querying the DB in the "new row" button's handler I notice that the underlying table hasn't been changed AND the slot I've attached to the beforeInsert() sigal (it's code is merely qDebug() << "INSERTING!"; is never executed.

So, why do no DB insertions happen? I have no exotic constraints on the columns, only NOT NULL, but they're always all filled out before clicking "new row". And besides the UI is behaving as if the row's been inserted