PDA

View Full Version : Fill a data record in the beforeInsert slot



graciano
16th February 2010, 17:33
Hi,

Imagine i have this:


void Dialog::beforeInsertX(QSqlRecord &record)
{
record.setValue("id", generateId("tablename"));
record.setValue("a", "xxx");
record.setValue("b", "yyy");
...
}

void Dialog::insertX()
{

int row = model->rowCount();
model->insertRow(row);
// ???
}


What showl i type in the // ??? in order to have model and view sinchronized when no editing is necessary?

Thanks

graciano
16th February 2010, 18:36
grrrrr ... christ!!
Must be related to the http://doc.trolltech.com/4.5/qsqltablemodel.html#EditStrategy-enum because after a model->submitall(); it is working fine.