diff --git a/src/sql/models/qsqltablemodel.cpp b/src/sql/models/qsqltablemodel.cpp index 1746883d34..7210ddce5b 100644 --- a/src/sql/models/qsqltablemodel.cpp +++ b/src/sql/models/qsqltablemodel.cpp @@ -1217,15 +1217,8 @@ bool QSqlTableModel::setRecord(int row, const QSqlRecord &record) } else if (d->strategy != OnManualSubmit) { // historical bug: this could all be simple like OnManualSubmit, but isn't const QModelIndex cIndex = createIndex(row, idx); - // historical bug: comparing EditRole with DisplayRole values here - const QVariant oldValue = data(cIndex); - const QVariant value = record.value(i); - // historical bug: it's a bad idea to check for change here - // historical bug: should test oldValue.isNull() != value.isNull() - if (oldValue.isNull() || oldValue != value) { - mrow.setValue(idx, record.value(i)); - emit dataChanged(cIndex, cIndex); - } + mrow.setValue(idx, record.value(i)); + emit dataChanged(cIndex, cIndex); } else { mrow.setValue(idx, record.value(i)); } diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp index 6a827e65c5..518c6b6d25 100644 --- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp @@ -412,10 +412,10 @@ void tst_QSqlTableModel::setRecord() model.submit(); else { // dataChanged() is not emitted when submitAll() is called - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.count(), model.columnCount()); QCOMPARE(spy.at(0).count(), 2); - QCOMPARE(qvariant_cast(spy.at(0).at(0)), model.index(i, 1)); - QCOMPARE(qvariant_cast(spy.at(0).at(1)), model.index(i, 1)); + QCOMPARE(qvariant_cast(spy.at(1).at(0)), model.index(i, 1)); + QCOMPARE(qvariant_cast(spy.at(1).at(1)), model.index(i, 1)); } }