summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qtreeview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/itemviews/qtreeview.cpp')
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index be42c8dac0..8d0a578f61 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1100,7 +1100,7 @@ void QTreeView::scrollTo(const QModelIndex &index, ScrollHint hint)
// Expand all parents if the parent(s) of the node are not expanded.
QModelIndex parent = index.parent();
- while (parent.isValid() && state() == NoState && d->itemsExpandable) {
+ while (parent != d->root && parent.isValid() && state() == NoState && d->itemsExpandable) {
if (!isExpanded(parent))
expand(parent);
parent = d->model->parent(parent);