Hi,

I have a custom function inside a reimplementation of QSqlTableModel that intents to change a field value after the insertion. I insert the new record with:

Qt Code:
  1. QSqlRecord newRecord;
  2. newRecord = mymodel->record();
  3. newRecord.setValue("CURRCODE","TestValue");
  4. mymodel->insertRecord(-1,newRecord);
  5. mymodel->updateNewRecord(); //Custom function
To copy to clipboard, switch view to plain text mode 

Inside the model, the custom function updateNewRecord has:
Qt Code:
  1. qDebug() << "Previous Value: " << record(this->rowCount()-1).value("CURRCODE").toString(); //Prints "TestValue"
  2. record(this->rowCount()-1).setValue("CURRCODE","Newvalue"); //Setting a new value
  3. qDebug() << "New Value: " << record(this->rowCount()-1).value(codeColumn).toString(); //Prints "TestValue"!!!
To copy to clipboard, switch view to plain text mode 

The problem is that after setting the value with setValue()I still have the old value ("TestValue")!!!

Any idea why?

Thanks,
Carlos.