diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-10 10:54:53 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-10 10:55:33 (GMT) |
commit | 8179a9e2cd52b24c70b194106dd170ed1bb677e4 (patch) | |
tree | 7284c59d7a89ab54612a4bc098a8929050c3e184 /src/gui/itemviews/qtreeview.cpp | |
parent | f2c4d2fe8a846cfce457512ef1806a7276745590 (diff) | |
download | Qt-8179a9e2cd52b24c70b194106dd170ed1bb677e4.zip Qt-8179a9e2cd52b24c70b194106dd170ed1bb677e4.tar.gz Qt-8179a9e2cd52b24c70b194106dd170ed1bb677e4.tar.bz2 |
small code cleanup that improves some loops
it uses les foreach
Diffstat (limited to 'src/gui/itemviews/qtreeview.cpp')
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index 7837700..965a5c7 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -2072,7 +2072,8 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie const bool useTopIndex = (cursorAction == MoveUp || cursorAction == MovePrevious); int index = useTopIndex ? INT_MAX : INT_MIN; const QItemSelection selection = d->selectionModel->selection(); - foreach (const QItemSelectionRange &range, selection) { + for (int i = 0; i < selection.count(); ++i) { + const QItemSelectionRange &range = selection.at(i); int candidate = d->viewIndex(useTopIndex ? range.topLeft() : range.bottomRight()); if (candidate >= 0) index = useTopIndex ? qMin(index, candidate) : qMax(index, candidate); @@ -3558,7 +3559,8 @@ QList<QPair<int, int> > QTreeViewPrivate::columnRanges(const QModelIndex &topInd QPair<int, int> current; current.first = -2; // -1 is not enough because -1+1 = 0 current.second = -2; - foreach (int logicalColumn, logicalIndexes) { + for(int i = 0; i < logicalIndexes.count(); ++i) { + const int logicalColumn = logicalIndexes.at(i); if (current.second + 1 != logicalColumn) { if (current.first != -2) { //let's save the current one |