forked from qt-creator/qt-creator
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:
@@ -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);
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user