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) { for (int i = 0; i < rowMap.count(); ++i) {
QVector<int> *sourceRows = rowMap.at(i); QVector<int> *sourceRows = rowMap.at(i);
QMutableVectorIterator<int> it(*sourceRows); for (auto it = sourceRows->begin(); it != sourceRows->end(); ++it) {
if ((*it) >= anchor) {
while (it.hasNext()) { *it += delta;
it.next();
if (it.value() >= anchor) {
it.setValue(it.value() + delta);
} }
} }
} }

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

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

Loading…
Cancel
Save