From a3ba364c9d2e87b418da07ee6ca050170449b434 Mon Sep 17 00:00:00 2001 From: ispyisail Date: Thu, 1 Oct 2026 10:04:52 +1300 Subject: [PATCH] Keep the label of a contact pasted together with its coil (#1187) A slave pasted with its master is relinked to the master's copy by initLink() (#997), so the slave data wipe that follows is only needed for a slave that comes out of it unlinked. Linked, it wiped the contact's label text while the link stayed. Co-Authored-By: Claude Opus 5.5 --- sources/diagramcommands.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index 0927ce815..d13a75f4d 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -124,8 +124,11 @@ void PasteDiagramCommand::redo() // function, cross-ref, etc.) in their elementInformations. // Always clear those on paste so the duplicate starts clean, // regardless of the user's erase-label-on-copy preference. + // A slave pasted together with its master was relinked to the + // master's copy by initLink() above: that data is still right, + // and its texts show the master's label, so leave it alone. const bool is_slave = (e->linkType() == Element::Slave); - if (is_slave) { + if (is_slave && e->isFree()) { DiagramContext dc = e->elementInformations(); dc.remove(QETInformation::ELMT_PLC_TYPE); dc.remove(QETInformation::ELMT_PLC_ADDRESS);