Improve generating pattern recipe.

If a pattern based on multisize measurements copy value to formula field.
This commit is contained in:
Roman Telezhynskyi 2021-11-25 12:16:28 +02:00
parent f28660e0ea
commit 2448ee4361

View File

@ -163,7 +163,16 @@ QDomElement VPatternRecipe::Measurement(const QSharedPointer<VMeasurement> &m)
SetAttribute(measurement, QStringLiteral("description"), m->GetDescription());
SetAttribute(measurement, QStringLiteral("fullName"), m->GetGuiText());
SetAttribute(measurement, QStringLiteral("name"), m->GetName());
SetAttribute(measurement, QStringLiteral("formula"), m->GetFormula()); // TODO: localize
QString formula = m->GetFormula();
if (not formula.isEmpty())
{
SetAttribute(measurement, QStringLiteral("formula"), m->GetFormula());
}
else
{
SetAttribute(measurement, QStringLiteral("formula"), *m->GetValue());
}
SetAttribute(measurement, QStringLiteral("value"), *m->GetValue());
return measurement;