From 64ed6fff6d68461d3e43d39ba8f6c3d1f3b29f2a Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 22 Apr 2024 13:57:30 +0300 Subject: [PATCH] QmlDesigner: Select model under cursor when using "Edit in 3D View" If selection context contains valid scene position, use that to select the model under cursor. Fixes: QDS-12346 Change-Id: I55c58ed303e1746b7b234fa6ac31272fdfafb40d Reviewed-by: Qt CI Patch Build Bot Reviewed-by: Mahmoud Badri --- .../components/componentcore/modelnodeoperations.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp index 66c1229a76e..a5274c70e2d 100644 --- a/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp +++ b/src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp @@ -1688,7 +1688,14 @@ void editIn3dView(const SelectionContext &selectionContext) if (selectionContext.view() && selectionContext.hasSingleSelectedModelNode() && selectionContext.currentSingleSelectedNode().metaInfo().isQtQuick3DView3D()) { QmlDesignerPlugin::instance()->mainWidget()->showDockWidget("Editor3D", true); - selectionContext.view()->emitView3DAction(View3DActionType::AlignViewToCamera, true); + const QPointF scenePos = selectionContext.scenePosition(); + if (scenePos.isNull()) { + selectionContext.view()->emitView3DAction(View3DActionType::AlignViewToCamera, true); + } else { + selectionContext.view()->emitCustomNotification("pick_3d_node_from_2d_scene", + {selectionContext.currentSingleSelectedNode()}, + {scenePos}); + } } }