dkite
10th September 2006, 20:07
I have a QSqlRelationalTableModel with a mysql driver, a tableview that shows the table which works. I am trying to add and edit records in a dialog with the fields for editing. I can transfer the data fine, but have a problem:
How do I save the data from a QDateTimeEdit?
model->database().transaction();
qDebug() <<"saveWidgetData: datachanged"<< datachanged;
//get each field's values and save.
record = model->record(recid.row());
//where recid is the QModelIndex
record.setValue(QString("description"),descriptionTextEdit->toPlainText());
record.setValue(QString("date"),dateDateTimeEdit->property("dateTime"));
then insertRecord, etc. The description is saved, new record is made, etc. No errors are reported. I've tried
record.setValue(QString("date"),dateDateTimeEdit->property("dateTime"));
with the same results. The date isn't inserted into the table. Any ideas?
How do I save the data from a QDateTimeEdit?
model->database().transaction();
qDebug() <<"saveWidgetData: datachanged"<< datachanged;
//get each field's values and save.
record = model->record(recid.row());
//where recid is the QModelIndex
record.setValue(QString("description"),descriptionTextEdit->toPlainText());
record.setValue(QString("date"),dateDateTimeEdit->property("dateTime"));
then insertRecord, etc. The description is saved, new record is made, etc. No errors are reported. I've tried
record.setValue(QString("date"),dateDateTimeEdit->property("dateTime"));
with the same results. The date isn't inserted into the table. Any ideas?