When expanding up the tree, there is no need to expand above root.
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 <tmartsum@gmail.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
316d8ececa
commit
5764f10323
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user