From d10b1fbee97713e5323567d73174ed71a819a409 Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Thu, 31 Aug 2023 16:33:12 +0200 Subject: [PATCH] QmlDesigner: Reparent Connection if retargeted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old implementation did the same. Change-Id: Iaf925bbbe7f47198aac319dbe930871854694316 Reviewed-by: Henning Gründl Reviewed-by: Qt CI Patch Build Bot --- .../components/connectioneditor/connectionmodel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp index 5311046ddc1..bcfcb63cb7b 100644 --- a/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp +++ b/src/plugins/qmldesigner/components/connectioneditor/connectionmodel.cpp @@ -936,8 +936,14 @@ void ConnectionModelBackendDelegate::handleTargetChanged() parentModelNode.signalHandlerProperty(handlerName).setSource(expression); } - if (oldTargetNodeName != newId) + if (oldTargetNodeName != newId) { parentModelNode.bindingProperty("target").setExpression(newId); + + const ModelNode parent = parentModelNode.view()->modelNodeForId(newId); + + if (parent.isValid() && QmlItemNode::isValidQmlVisualNode(parent)) + parent.nodeListProperty("data").reparentHere(parentModelNode); + } }); }