QMimeData: use reserve in formats()
... to optimize memory allocation. Change-Id: I039a6de6f97858f339b83ca7e3e361963eaa61ee Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
451273523d
commit
7ee1fc4c29
@ -628,7 +628,9 @@ QStringList QMimeData::formats() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QStringList list;
|
||||
for (int i=0; i<d->dataList.size(); i++)
|
||||
const int size = d->dataList.size();
|
||||
list.reserve(size);
|
||||
for (int i = 0; i < size; ++i)
|
||||
list += d->dataList.at(i).format;
|
||||
return list;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user