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?
modDetails->setTable("x"+ka->getShortText());
modDetails->select();
modDetails->removeColumn(0); // don't show the ID
modDetails->setHeaderData(0, Qt::Horizontal, tr("Abk."));
modDetails->setHeaderData(1, Qt::Horizontal, tr("Bezeichnung"));
// tableDetail is a tableview created in Designer
tableDetail->setModel(modDetails);
tableDetail->show();
QSqlTableModel* modDetails;
modDetails->setTable("x"+ka->getShortText());
modDetails->setEditStrategy(QSqlTableModel::OnFieldChange);
modDetails->select();
modDetails->removeColumn(0); // don't show the ID
modDetails->setHeaderData(0, Qt::Horizontal, tr("Abk."));
modDetails->setHeaderData(1, Qt::Horizontal, tr("Bezeichnung"));
// tableDetail is a tableview created in Designer
tableDetail->setModel(modDetails);
tableDetail->show();
To copy to clipboard, switch view to plain text mode
Bookmarks