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:
parent
9e2a389fa9
commit
2713a4534b
@ -347,7 +347,11 @@ void QListModel::ensureSorted(int column, Qt::SortOrder order, int start, int en
|
|||||||
bool changed = false;
|
bool changed = false;
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
int oldRow = sorting.at(i).second;
|
int oldRow = sorting.at(i).second;
|
||||||
|
int tmpitepos = lit - tmp.begin();
|
||||||
QListWidgetItem *item = tmp.takeAt(oldRow);
|
QListWidgetItem *item = tmp.takeAt(oldRow);
|
||||||
|
if (tmpitepos > tmp.size())
|
||||||
|
--tmpitepos;
|
||||||
|
lit = tmp.begin() + tmpitepos;
|
||||||
lit = sortedInsertionIterator(lit, tmp.end(), order, item);
|
lit = sortedInsertionIterator(lit, tmp.end(), order, item);
|
||||||
int newRow = qMax(lit - tmp.begin(), 0);
|
int newRow = qMax(lit - tmp.begin(), 0);
|
||||||
lit = tmp.insert(lit, item);
|
lit = tmp.insert(lit, item);
|
||||||
|
Loading…
Reference in New Issue
Block a user