Hi,
I'm calling primeInsert(int,QSqlRecord&) in order to set initial values for a QTableView/QSqlTableModel approach (not sure about this).
Qt Code:
  1. void Dialog::primeInsertImage(int row, QSqlRecord &record)
  2. {
  3. record.setValue("id", generateNextId("object")); // To get the next free id
  4. record.setValue("name", ui->fileNameLabel->text()); // To get a QString from a QLabel
  5. QImage currentImage = ui->imageLabel->pixmap()->toImage();
  6. QByteArray bytes;
  7. QBuffer buffer(&bytes);
  8. buffer.open(QIODevice::WriteOnly);
  9. currentImage.save(&buffer, "PNG");
  10. record.setValue("image", bytes); //To get the image previously loaded into a QLabel
  11. }
To copy to clipboard, switch view to plain text mode 

The insert code is:
Qt Code:
  1. void Dialog::on_InsertRecord_clicked()
  2. {
  3. view->setFocus();
  4. int row = model->rowCount();
  5. model->insertRows(row,1);
  6. QModelIndex index = model->index(row, model->fieldIndex("id"));
  7. view->setCurrentIndex(index);
  8. view->edit(index);
  9. }
To copy to clipboard, switch view to plain text mode 

It works fine until i press enter (change record in the view).

Then i only get one fiel with data (The id).
The "name" and "image" fiels are NULL!

What could i be doing wrong?