QmlDesigner: Don't expand the selected node on selection change

Point of expanding items at selection change is to ensure the selected
item is visible. It is not necessary to also expand the selected item.

Change-Id: I2435daf4845b5066ddb41a4aeae71d66e12fd94d
Fixes: QDS-1940
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2020-04-23 14:12:15 +03:00
parent 51993ea62d
commit 923bd79323
2 changed files with 4 additions and 4 deletions

View File

@@ -442,7 +442,7 @@ void NavigatorView::updateItemSelection()
// make sure selected nodes a visible
foreach (const QModelIndex &selectedIndex, itemSelection.indexes()) {
if (selectedIndex.column() == 0)
expandRecursively(selectedIndex);
expandAncestors(selectedIndex);
}
}
@@ -466,9 +466,9 @@ bool NavigatorView::blockSelectionChangedSignal(bool block)
return oldValue;
}
void NavigatorView::expandRecursively(const QModelIndex &index)
void NavigatorView::expandAncestors(const QModelIndex &index)
{
QModelIndex currentIndex = index;
QModelIndex currentIndex = index.parent();
while (currentIndex.isValid()) {
if (!treeWidget()->isExpanded(currentIndex))
treeWidget()->expand(currentIndex);

View File

@@ -110,7 +110,7 @@ protected: //functions
QTreeView *treeWidget() const;
NavigatorTreeModel *treeModel();
bool blockSelectionChangedSignal(bool block);
void expandRecursively(const QModelIndex &index);
void expandAncestors(const QModelIndex &index);
void reparentAndCatch(NodeAbstractProperty property, const ModelNode &modelNode);
void setupWidget();