hi, i have a tableview showing a QSqlTableModel. I had thought that this would allow me to just click into any cell and change the contents? now i can click in the cell and change, but as soon as i leave the cell the old value is there again. What am i missing?
Qt Code:
  1. QSqlTableModel* modDetails;
  2. modDetails->setTable("x"+ka->getShortText());
  3. modDetails->setEditStrategy(QSqlTableModel::OnFieldChange);
  4. modDetails->select();
  5. modDetails->removeColumn(0); // don't show the ID
  6. modDetails->setHeaderData(0, Qt::Horizontal, tr("Abk."));
  7. modDetails->setHeaderData(1, Qt::Horizontal, tr("Bezeichnung"));
  8. // tableDetail is a tableview created in Designer
  9. tableDetail->setModel(modDetails);
  10. tableDetail->show();
To copy to clipboard, switch view to plain text mode