summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-06-10 10:54:53 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-06-10 10:55:33 (GMT)
commit8179a9e2cd52b24c70b194106dd170ed1bb677e4 (patch)
tree7284c59d7a89ab54612a4bc098a8929050c3e184 /src/gui/itemviews
parentf2c4d2fe8a846cfce457512ef1806a7276745590 (diff)
downloadQt-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')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp4
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp7
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp4
-rw-r--r--src/gui/itemviews/qtreeview.cpp6
4 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index c90216b..d353c2d 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2398,8 +2398,8 @@ void QAbstractItemView::updateEditorGeometries()
//we release the editor outside of the loop because it might change the focus and try
//to change the d->editors list.
- foreach(QWidget *editor, editorsToRelease) {
- d->releaseEditor(editor);
+ for (int i = 0; i < editorsToRelease.count(); ++i) {
+ d->releaseEditor(editorsToRelease.at(i));
}
}
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index 96eb6f0..4021c83 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -884,8 +884,8 @@ void QSortFilterProxyModelPrivate::proxy_item_range(
{
proxy_low = INT_MAX;
proxy_high = INT_MIN;
- foreach (int source_item, source_items) {
- int proxy_item = source_to_proxy.at(source_item);
+ for (int i = 0; i < source_items.count(); ++i) {
+ int proxy_item = source_to_proxy.at(source_items.at(i));
Q_ASSERT(proxy_item != -1);
if (proxy_item < proxy_low)
proxy_low = proxy_item;
@@ -985,7 +985,8 @@ QSet<int> QSortFilterProxyModelPrivate::handle_filter_changed(
Q_Q(QSortFilterProxyModel);
// Figure out which mapped items to remove
QVector<int> source_items_remove;
- foreach (int source_item, proxy_to_source) {
+ for (int i = 0; i < proxy_to_source.count(); ++i) {
+ const int source_item = proxy_to_source.at(i);
if ((orient == Qt::Vertical)
? !q->filterAcceptsRow(source_item, source_parent)
: !q->filterAcceptsColumn(source_item, source_parent)) {
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index d8adbd2..9d0f796 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -2907,8 +2907,8 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
QStack<QStandardItem*> stack;
itemsSet.reserve(indexes.count());
stack.reserve(indexes.count());
- foreach (const QModelIndex &index, indexes) {
- QStandardItem *item = itemFromIndex(index);
+ for (int i = 0; i < indexes.count(); ++i) {
+ QStandardItem *item = itemFromIndex(indexes.at(i));
itemsSet << item;
stack.push(item);
}
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