QListWidget - iterator fix in QListModel::ensureSorted

This is a fix similar to 7ddf1b14ec

Change-Id: I369f428252527a8c3326c0f23a1dc31b63f884f5
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Thorbjørn Martsum 2013-07-08 11:29:35 +02:00 committed by The Qt Project
parent 9e2a389fa9
commit 2713a4534b

View File

@ -347,7 +347,11 @@ void QListModel::ensureSorted(int column, Qt::SortOrder order, int start, int en
bool changed = false;
for (int i = 0; i < count; ++i) {
int oldRow = sorting.at(i).second;
int tmpitepos = lit - tmp.begin();
QListWidgetItem *item = tmp.takeAt(oldRow);
if (tmpitepos > tmp.size())
--tmpitepos;
lit = tmp.begin() + tmpitepos;
lit = sortedInsertionIterator(lit, tmp.end(), order, item);
int newRow = qMax(lit - tmp.begin(), 0);
lit = tmp.insert(lit, item);