Port from QMutableList|VectorIterator to STL iterators

wilder-5.25
Volker Krause 4 years ago committed by David Edmundson
parent 7714283680
commit 51287cc29d
  1. 10
      libnotificationmanager/notificationgroupingproxymodel.cpp
  2. 10
      libtaskmanager/taskgroupingproxymodel.cpp
  3. 21
      libtaskmanager/tasksmodel.cpp

@ -87,13 +87,9 @@ void NotificationGroupingProxyModel::adjustMap(int anchor, int delta)
{
for (int i = 0; i < rowMap.count(); ++i) {
QVector<int> *sourceRows = rowMap.at(i);
QMutableVectorIterator<int> it(*sourceRows);
while (it.hasNext()) {
it.next();
if (it.value() >= anchor) {
it.setValue(it.value() + delta);
for (auto it = sourceRows->begin(); it != sourceRows->end(); ++it) {
if ((*it) >= anchor) {
*it += delta;
}
}
}

@ -239,13 +239,9 @@ void TaskGroupingProxyModel::Private::adjustMap(int anchor, int delta)
{
for (int i = 0; i < rowMap.count(); ++i) {
QVector<int> *sourceRows = rowMap.at(i);
QMutableVectorIterator<int> it(*sourceRows);
while (it.hasNext()) {
it.next();
if (it.value() >= anchor) {
it.setValue(it.value() + delta);
for (auto it = sourceRows->begin(); it != sourceRows->end(); ++it) {
if ((*it) >= anchor) {
*it += delta;
}
}
}

@ -22,6 +22,7 @@
#include <QGuiApplication>
#include <QTimer>
#include <QUrl>
#include <QVector>
#include <numeric>
@ -218,13 +219,9 @@ void TasksModel::Private::initModels()
}
const int delta = (end - start) + 1;
QMutableListIterator<int> it(sortedPreFilterRows);
while (it.hasNext()) {
it.next();
if (it.value() >= start) {
it.setValue(it.value() + delta);
for (auto it = sortedPreFilterRows.begin(); it != sortedPreFilterRows.end(); ++it) {
if ((*it) >= start) {
*it += delta;
}
}
@ -271,13 +268,9 @@ void TasksModel::Private::initModels()
}
const int delta = (last - first) + 1;
QMutableListIterator<int> it(sortedPreFilterRows);
while (it.hasNext()) {
it.next();
if (it.value() > last) {
it.setValue(it.value() - delta);
for (auto it = sortedPreFilterRows.begin(); it != sortedPreFilterRows.end(); ++it) {
if ((*it) > last) {
*it -= delta;
}
}
});

Loading…
Cancel
Save