Hello!

Is it possible to insert row into database using QSqlTableModel giving only NOT NULL values for new row.

For example I have table with 3 collumns:
Qt Code:
  1. ID (which is NOT NULL autoincremented integer field using postgresql sequence)
  2. Name (which is NOT NULL varchar value with default value 'John')
  3. Age (which is integer)
To copy to clipboard, switch view to plain text mode 

I try to do something like this but it doesn't work (no new row is inserted into table):

Qt Code:
  1. model.insertRows(0, 1);
  2. model.setData(model.index(0, 1), "Bill");
  3. model.setData(model.index(0, 2), 47);
  4. model.submitAll();
To copy to clipboard, switch view to plain text mode 

Do I have to retrive next value for ID field from database and then set it for new row using setData or is there some other way?

Thanks,
m15ch4