QSqlTableModel::record: Use the const & we're given

QSqlTableModelPrivate::ModifiedRow::rec returns a const &
so use it instead doing a copy. QSqlRecord is cheap to copy constructor
but not having to do it is faster

Change-Id: Iad6e79fcdcdf380ce681fe9426436f8cb98be553
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
This commit is contained in:
Albert Astals Cid 2019-10-11 17:31:22 +02:00
parent 375efdd0e1
commit 9d504e1150

View File

@ -1369,7 +1369,7 @@ QSqlRecord QSqlTableModel::record(int row) const
// get generated flags from the cache
const QSqlTableModelPrivate::ModifiedRow mrow = d->cache.value(row);
if (mrow.op() != QSqlTableModelPrivate::None) {
const QSqlRecord crec = mrow.rec();
const QSqlRecord &crec = mrow.rec();
for (int i = 0, cnt = rec.count(); i < cnt; ++i)
rec.setGenerated(i, crec.isGenerated(i));
}