From 5764f1032310065ee2620d5f06e3db75fcaaa2b1 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 31 Jan 2013 12:38:09 +0100 Subject: [PATCH] When expanding up the tree, there is no need to expand above root. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The index set by setRootIndex is the root of the visible part of the model. Expanding more than that is not needed. Change-Id: I0015e313ef046ff63c67338c4f00c37e1aa71ca7 Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qtreeview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 1f922dd6e39..6046ef50a5d 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -1097,7 +1097,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);