QmlDesigner: Fix scrollTo multi select behavior

Instead of scrolling to the first element in the selection, scroll to
the last. This will keep the existing behavior for single selection
and will fix the behavior for multi selection.

Task-number: QDS-9794
Change-Id: I846c6ea6b967ef76a77d4ea0fc819d06772eca01
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Henning Gruendl
2024-02-16 18:41:13 +01:00
committed by Henning Gründl
parent 695548cc81
commit fa14c8dfab

View File

@@ -700,7 +700,7 @@ void NavigatorView::updateItemSelection()
blockSelectionChangedSignal(blocked);
if (!selectedModelNodes().isEmpty())
treeWidget()->scrollTo(indexForModelNode(selectedModelNodes().constFirst()));
treeWidget()->scrollTo(indexForModelNode(selectedModelNodes().constLast()));
// make sure selected nodes are visible
for (const QModelIndex &selectedIndex : itemSelection.indexes()) {