MementoMori
29th April 2011, 18:15
running this code
MasterDialog dlg(this->master, this->details, index, this);
if(dlg.exec() == QDialog::Accepted){
dlg.submit();
if(!this->master->submitAll()){
QMessageBox::critical(this, "cant save data", master->lastError().text());
this->master->revertAll();
this->details->revertAll();
return;
}
if(!this->details->submitAll()){
QMessageBox::critical(this, "cant save data", details->lastError().text());
this->master->revertAll();
this->details->revertAll();
return;
}
}
changes from the details model aren't saved to the database. If you comment
if(!this->master->submitAll()){
QMessageBox::critical(this, "cant save data", master->lastError().text());
this->master->revertAll();
this->details->revertAll();
return;
}
the details are correctly saved.
the project is attached. It uses a sqlite memory db so it should be simple to run and test it.
MasterDialog dlg(this->master, this->details, index, this);
if(dlg.exec() == QDialog::Accepted){
dlg.submit();
if(!this->master->submitAll()){
QMessageBox::critical(this, "cant save data", master->lastError().text());
this->master->revertAll();
this->details->revertAll();
return;
}
if(!this->details->submitAll()){
QMessageBox::critical(this, "cant save data", details->lastError().text());
this->master->revertAll();
this->details->revertAll();
return;
}
}
changes from the details model aren't saved to the database. If you comment
if(!this->master->submitAll()){
QMessageBox::critical(this, "cant save data", master->lastError().text());
this->master->revertAll();
this->details->revertAll();
return;
}
the details are correctly saved.
the project is attached. It uses a sqlite memory db so it should be simple to run and test it.