From 5961f52a73df91e8e2c4da27d16580396eb0a7a1 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 18 Aug 2017 14:56:18 +0300 Subject: [PATCH] Fix label conversion. --HG-- branch : feature --- src/libs/ifc/xml/vpatternconverter.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index a1265d674..d4e15a3f9 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -2204,6 +2204,8 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() for (int i = 0; i < nodeList.size(); ++i) { QDomElement dataTag = nodeList.at(i).toElement(); + QDomNodeList nodeListMCP = dataTag.childNodes(); + const int count = nodeListMCP.count(); try { if (not GetParametrString(dataTag, strLetter, "").isEmpty()) @@ -2216,14 +2218,13 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() AddLabelTemplateLineV0_6_0(dataTag, "%pName%", true, false, Qt::AlignHCenter, 2); - QDomNodeList nodeListMCP = dataTag.childNodes(); - for (int iMCP = 0; iMCP < nodeListMCP.count(); ++iMCP) + for (int iMCP = 0; iMCP < count; ++iMCP) { QDomElement domMCP = nodeListMCP.at(iMCP).toElement(); QString line; - const int material = GetParametrUInt(domMCP, strMaterial, 0); + const int material = GetParametrUInt(domMCP, strMaterial, "0"); switch(material) { case 0: @@ -2245,7 +2246,7 @@ void VPatternConverter::PortPieceLabelstoV0_6_0() } line.append(", %wCut% %pQuantity%"); - if (GetParametrUInt(domMCP, strPlacement, 0) == 1) + if (GetParametrUInt(domMCP, strPlacement, "0") == 1) { line.append(" %wOnFold%"); }