summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qtreewidgetitemiterator.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gui/itemviews/qtreewidgetitemiterator.cpp b/src/gui/itemviews/qtreewidgetitemiterator.cpp
index ea98884..66dbdf5 100644
--- a/src/gui/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/gui/itemviews/qtreewidgetitemiterator.cpp
@@ -99,7 +99,7 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFl
Q_ASSERT(model);
d_ptr.reset(new QTreeWidgetItemIteratorPrivate(this, model));
model->iterators.append(this);
- if (!model->rootItem->children.isEmpty()) current = model->rootItem->children.first();
+ if (!model->rootItem->children.isEmpty()) current = model->rootItem->child(0);
if (current && !matchesFlags(current))
++(*this);
}
@@ -128,14 +128,13 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidgetItem *item, Iterator
// the beginning.
QTreeWidgetItem *parent = item;
parent = parent->parent();
- QList<QTreeWidgetItem *> children = parent ? parent->children : d->m_model->rootItem->children;
- d->m_currentIndex = children.indexOf(item);
+ QTreeWidgetItem *root = d->m_model->rootItem;
+ d->m_currentIndex = (parent ? parent : root)->indexOfChild(item);
while (parent) {
QTreeWidgetItem *itm = parent;
parent = parent->parent();
- QList<QTreeWidgetItem *> children = parent ? parent->children : d->m_model->rootItem->children;
- int index = children.indexOf(itm);
+ const int index = (parent ? parent : root)->indexOfChild(itm);
d->m_parentIndex.prepend(index);
}