From 5862264a1ddf313560cdf23cf60e40309832fb87 Mon Sep 17 00:00:00 2001 From: BojanKverh Date: Sun, 23 Oct 2016 21:24:16 +0200 Subject: [PATCH] Fixed saving grainline formulas when grainline is set to not visible --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 13 ++++++++++--- src/libs/vtools/undocommands/savedetailoptions.cpp | 7 ++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 02840d407..4a681cee7 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -726,16 +726,23 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document ptPos.setX(GetParametrDouble(element, AttrMx, "0")); ptPos.setY(GetParametrDouble(element, AttrMy, "0")); detail.GetGrainlineGeometry().SetPos(ptPos); - if (detail.GetGrainlineGeometry().IsVisible() == true) + try { QString qsLength = GetParametrString(element, AttrLength); detail.GetGrainlineGeometry().SetLength(qsLength); + } + catch (...) + { + detail.GetGrainlineGeometry().SetLength(""); + } + + try + { QString qsRot = GetParametrString(element, VToolDetail::AttrRotation); detail.GetGrainlineGeometry().SetRotation(qsRot); } - else + catch(...) { - detail.GetGrainlineGeometry().SetLength(""); detail.GetGrainlineGeometry().SetRotation(""); } } diff --git a/src/libs/vtools/undocommands/savedetailoptions.cpp b/src/libs/vtools/undocommands/savedetailoptions.cpp index 5cdf5d57a..5cc0c525d 100644 --- a/src/libs/vtools/undocommands/savedetailoptions.cpp +++ b/src/libs/vtools/undocommands/savedetailoptions.cpp @@ -208,11 +208,8 @@ void SaveDetailOptions::SaveGrainline(QDomElement &domElement, const VDetail &de doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr); doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x()); doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); - if (glGeom.IsVisible() == true) - { - doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); - doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation()); - } + doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); + doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation()); domElement.appendChild(domData); }