I have a table that contains recipe records. The application has been around since 2004. Now moving it into Qt5. I'm having issues updating a field in an existing record. When the operator wants to save a new recipe with the same recipe code. I need to set the current recipe "isactive" boolean false. This has worked fine until now. The Qt4 code looks like ...

Qt Code:
  1. QString sqlWhere;
  3. sqlWhere.append("recipecode='");
  4. sqlWhere.append(cboRecipeSelect->currentText());
  5. sqlWhere.append( "' AND isactive=true");
  6. QSqlTableModel recipeTable;
  7. recipeTable.setTable("recipe");
  8. recipeTable.setFilter(sqlWhere);
  9. recipeTable.select();
  10. QSqlRecord recRecipe = recipeTable.record(0);
  11. if (!recRecipe.isEmpty()) // backwards way to say record exists
  12. {
  13. // if we get this far, it's an update
  14. recRecipe.setValue("isactive",false);
  15. recipeTable.setRecord(0,recRecipe);
  16. recipeTable.submitAll(); // and update the existing record
  17. qDebug () << "updating recipe record to not active " <<recipeTable.lastError().text();
To copy to clipboard, switch view to plain text mode 

qDebug shows " ". And the field in the record remains "true".

What am I missing / failing to understand?