From 2448ee436153390f66c2b0cced3865f27e4dbd2a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 25 Nov 2021 12:16:28 +0200 Subject: [PATCH] Improve generating pattern recipe. If a pattern based on multisize measurements copy value to formula field. --- src/libs/vformat/vpatternrecipe.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libs/vformat/vpatternrecipe.cpp b/src/libs/vformat/vpatternrecipe.cpp index 962c8103b..b6b3adaa3 100644 --- a/src/libs/vformat/vpatternrecipe.cpp +++ b/src/libs/vformat/vpatternrecipe.cpp @@ -163,7 +163,16 @@ QDomElement VPatternRecipe::Measurement(const QSharedPointer &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;