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

@ -225,6 +225,7 @@ namespace autonum
str.replace("%{supplier}", dc.value("supplier").toString());
str.replace("%{quantity}", dc.value("quantity").toString());
str.replace("%{unity}", dc.value("unity").toString());
str.replace("%{auxiliary1}", dc.value("auxiliary1").toString());
str.replace("%{description_auxiliary1}", dc.value("description_auxiliary1").toString());
str.replace("%{designation_auxiliary1}", dc.value("designation_auxiliary1").toString());
@ -264,10 +265,14 @@ namespace autonum
str.replace("%{unity_auxiliary4}", dc.value("unity_auxiliary4").toString());
str.replace("%{machine_manufacturer_reference}",
dc.value("machine_manufacturer_reference").toString());
str.replace("%{machine_manufacturer_reference}", dc.value("machine_manufacturer_reference").toString());
str.replace("%{location}", dc.value("location").toString());
str.replace("%{function}", dc.value("function").toString());
str.replace("%{tension_protocol}", dc.value("tension_protocol").toString());
str.replace("%{conductor_section}", dc.value("conductor_section").toString());
str.replace("%{conductor_color}", dc.value("conductor_color").toString());
str.replace("%{void}", QString());
return str;

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;