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 <ci_patchbuild_bot@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-04-22 13:57:30 +03:00
parent 10bcd931c6
commit 64ed6fff6d

View File

@@ -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});
}
}
}