summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qstringlistmodel.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2013-10-06 22:50:12 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-01-15 21:49:14 +0000
commit1a84e55b8ffc2fee811e9dc61cce6faa3372e1ab (patch)
tree27c9b654c90b8309921ef6f6721559c7d1449e80 /src/corelib/itemmodels/qstringlistmodel.cpp
parent982656351be2f4ec84803022f5ce92f3755a44ad (diff)
QtCore: replace uses of inefficient QList<QPair>s with QVectors [itemmodels]
These QPairs are larger than a void*, so holding them in QLists is needlessly inefficient. Worse, the code could come to depend on the fragile property of (inefficient) QLists that references to elements therein never are invalidated. Fix by holding them in QVector instead. Change-Id: Ie8d8eff3448ada7aef5dfba7fc701a59821f5b54 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/itemmodels/qstringlistmodel.cpp')
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp
index 5f39fa60d7..e28348474c 100644
--- a/src/corelib/itemmodels/qstringlistmodel.cpp
+++ b/src/corelib/itemmodels/qstringlistmodel.cpp
@@ -262,7 +262,7 @@ void QStringListModel::sort(int, Qt::SortOrder order)
{
emit layoutAboutToBeChanged(QList<QPersistentModelIndex>(), VerticalSortHint);
- QList<QPair<QString, int> > list;
+ QVector<QPair<QString, int> > list;
const int lstCount = lst.count();
list.reserve(lstCount);
for (int i = 0; i < lstCount; ++i)