mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-09 05:24:14 +02:00
b7f516d485
When duplicating a diagram page, copied slave elements retain stale data from the source: labels, descriptions, link references, and PLC master information (type, address, function, comment, cross-ref, timer values) remain in the copies. Fix by adding clearPendingLinks() to Element to prevent copies from linking back to source elements via stale UUIDs, and by cleaning up copied element data after fromXml(): - Slaves always lose their label, formula, comment, location, and PLC master data, since their text comes from a master element which is not available on the copy. The displayed text on slave elements is cleared directly via setPlainText(), but UserText items (free text typed by the user) are preserved. - For PLC slaves, setElementInformations() is called without m_block_alignment so that elementInfoChanged() can run finishAlignment() to correctly adjust text positions for the cleared content. - Non-slave elements respect the existing erase-label-on-copy preference, same as PasteDiagramCommand::redo(). - Conductor labels are also reset when erase-label-on-copy is active, matching PasteDiagramCommand::redo() (issue #413). - Text alignment is preserved by wrapping setElementInformations() with m_block_alignment for non-slave elements, same as Element::fromXml().