correcting the visibility of Variables in CompositeText

When using composite text in report elements, the name of the variable
was displayed when inserting the reportElement into the drawing (e.g.
%{function}). This is corrected here.
Add missing variables to assignvariables.cpp
This commit is contained in:
achim
2025-08-02 22:16:12 +02:00
parent fb01e51bbb
commit f20ea041b6
2 changed files with 27 additions and 4 deletions

View File

@@ -1212,6 +1212,12 @@ QString DynamicElementTextItem::reportReplacedCompositeText() const
label = autonum::AssignVariables::formulaToLabel(label, elmt->rSequenceStruct(), elmt->diagram(), elmt);
string.replace("%{label}", label);
}
// if element is not linked, replace an empty string
else
{
string.replace("%{label}", "");
}
if (m_watched_conductor)
{
if(string.contains("%{function}"))
@@ -1223,6 +1229,18 @@ QString DynamicElementTextItem::reportReplacedCompositeText() const
if(string.contains("%{conductor_section}"))
string.replace("%{conductor_section}", m_watched_conductor.data()->properties().m_wire_section);
}
// if no conductor is connected, replace an empty String
else
{
if(string.contains("%{function}"))
string.replace("%{function}", "");
if(string.contains("%{tension_protocol}"))
string.replace("%{tension_protocol}", "");
if(string.contains("%{conductor_color}"))
string.replace("%{conductor_color}", "");
if(string.contains("%{conductor_section}"))
string.replace("%{conductor_section}", "");
}
}
return string;