aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/types
diff options
context:
space:
mode:
authorSérgio Martins <sergio.martins@kdab.com>2015-06-03 23:23:50 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-05 08:37:39 +0000
commit198b2f38657987bbd0186e18627da5d7c1ab614a (patch)
tree98ad26b3e0f3827421c9e0a7744ed0e8fc62226b /src/qml/types
parent3d12cf7bac7a06a94a60211e2f40017c3c3a7ba0 (diff)
Add missing QVector::reserve() calls
Change-Id: Iab7c9949941559b4773e5d4a0406dc58cfc70adb Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/types')
-rw-r--r--src/qml/types/qqmllistmodel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index b376ce7fcb..6fc0e4a9d8 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -150,7 +150,9 @@ const ListLayout::Role &ListLayout::createRole(const QString &key, ListLayout::R
ListLayout::ListLayout(const ListLayout *other) : currentBlock(0), currentBlockOffset(0)
{
- for (int i=0 ; i < other->roles.count() ; ++i) {
+ const int otherRolesCount = other->roles.count();
+ roles.reserve(otherRolesCount);
+ for (int i=0 ; i < otherRolesCount; ++i) {
Role *role = new Role(other->roles[i]);
roles.append(role);
roleHash.insert(role->name, role);