From ff65b85357b69edb8483aaf205f6aaccf69cbbb5 Mon Sep 17 00:00:00 2001 From: DaTweety <129504390+DaTweety@users.noreply.github.com> Date: Sat, 17 Oct 2026 20:22:57 +0200 Subject: [PATCH] Report composite texts: element information and the partner's label A folio report whose text is a composite text replaced only %{label} and the conductor variables. The report's own information is now replaced as well, as on any other element, so a report can name the device and terminal it leads to: "%{comment} %{label}" reads "-XS27:N +UV1/2 UG Raum - 1.1" like EPLAN's interruption points. Changing a report's information rebuilt such a text the way an ordinary element's is built, turning %{label} into the report's stored label, where its partner was when last saved. It now takes the same text updateReportText() builds. Co-Authored-By: Claude Opus 5.5 --- sources/qetgraphicsitem/dynamicelementtextitem.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index fcc5e4121..51a14ed0b 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -1143,7 +1143,12 @@ void DynamicElementTextItem::elementInfoChanged() if (m_composite_text.contains("%{label}")) setupFormulaConnection(); - final_text = autonum::AssignVariables::replaceVariable(m_composite_text, dc); + //A report's %{label} is where its partner is, not its own + //label: the same text updateReportText() builds + if (m_parent_element && (m_parent_element.data()->linkType() & Element::AllReport)) + final_text = reportReplacedCompositeText(); + else + final_text = autonum::AssignVariables::replaceVariable(m_composite_text, dc); } else if (m_text_from == UserText) final_text = m_text; @@ -1584,6 +1589,13 @@ QString DynamicElementTextItem::reportReplacedCompositeText() const if(string.contains("%{conductor_section}")) string.replace("%{conductor_section}", ""); } + + //What is left is the report's own information, as in the + //composite text of any other element: a report can then say + //which device and terminal it leads to (%{comment}), the way + //EPLAN prints "-XS27:N 2 UG Raum - 1.1" + string = autonum::AssignVariables::replaceVariable( + string, m_parent_element.data()->elementInformations()); } return string;