[SOLVED] QSqlRelationalTableModel::insertRows + sqlite and autoincrementing primary keys
I'm using a sqlite database with the Qt sql module.
My QSqlRelationalTableModel is viewed in a QTableView:
My table has a primary key with auto increment. In my user interface, I have a button for adding rows to the table.
I add a row like this:
However, when the new row appears in the view, the primary key is not filled in. I can enter data into the other fields, and sometimes that makes the primary id appear in the primary key field, but not always.
I'm obviously doing something wrong. I'd appreciate any help, and "best practices" - type information.
Thanks in advance!
@QSqlRecord newRecord = m_tableModel->record();
and it works.