* Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com> *
* Copyright (C) 2013 by Frank Reininghaus <frank78ac@googlemail.com> *
* *
- * Based on the Itemviews NG project from Trolltech Labs: *
- * http://qt.gitorious.org/qt-labs/itemviews-ng *
+ * Based on the Itemviews NG project from Trolltech Labs *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
{
public:
KItemRangeList() : QList<KItemRange>() {}
- KItemRangeList(const QList<KItemRange>& list) : QList<KItemRange>(list) {}
+ explicit KItemRangeList(const QList<KItemRange>& list) : QList<KItemRange>(list) {}
template<class Container>
static KItemRangeList fromSortedContainer(const Container& container);
int index = *it;
int count = 1;
- ++it;
+ // Remove duplicates, see https://bugs.kde.org/show_bug.cgi?id=335672
+ while (it != end && *it == index) {
+ ++it;
+ }
while (it != end) {
if (*it == index + count) {
count = 1;
}
++it;
+
+ // Remove duplicates, see https://bugs.kde.org/show_bug.cgi?id=335672
+ while (it != end && *it == *(it - 1)) {
+ ++it;
+ }
}
result << KItemRange(index, count);