QStringListModel: proper construction of vector

... with known size and known value by corresponding ctor.

Don't use appending for this case.

Change-Id: I70f5b943cda7e55eeb45becf439f79c9aee77278
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Anton Kudryavtsev 2016-04-12 18:35:45 +03:00
parent f083830b8d
commit bdf2d7e0af

View File

@ -187,7 +187,7 @@ bool QStringListModel::setData(const QModelIndex &index, const QVariant &value,
if (index.row() >= 0 && index.row() < lst.size()
&& (role == Qt::EditRole || role == Qt::DisplayRole)) {
lst.replace(index.row(), value.toString());
emit dataChanged(index, index, QVector<int>() << role);
emit dataChanged(index, index, QVector<int>(1, role));
return true;
}
return false;