From abb7147bc8cd0b719dff003f304549e694b786dc Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 12 Dec 2015 13:15:29 +0200 Subject: [PATCH] Return 0 if default height/size is not custom. --HG-- branch : develop --- src/app/valentina/xml/vpattern.cpp | 50 +++++++++++++++++++----------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index db80262bd..2a4b59cfb 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -2491,17 +2491,24 @@ void VPattern::SetDefCustom(bool value) //--------------------------------------------------------------------------------------------------------------------- int VPattern::GetDefCustomHeight() const { - QDomNodeList tags = elementsByTagName(TagGradation); - if (tags.size() == 0) + if (IsDefCustom()) { - return 0; - } + QDomNodeList tags = elementsByTagName(TagGradation); + if (tags.size() == 0) + { + return 0; + } - const QDomNode domNode = tags.at(0); - const QDomElement domElement = domNode.toElement(); - if (domElement.isNull() == false) - { - return static_cast(GetParametrUInt(domElement, AttrDefHeight, QStringLiteral("0"))); + const QDomNode domNode = tags.at(0); + const QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + return static_cast(GetParametrUInt(domElement, AttrDefHeight, QStringLiteral("0"))); + } + else + { + return 0; + } } else { @@ -2542,17 +2549,24 @@ void VPattern::SetDefCustomHeight(int value) //--------------------------------------------------------------------------------------------------------------------- int VPattern::GetDefCustomSize() const { - QDomNodeList tags = elementsByTagName(TagGradation); - if (tags.size() == 0) + if (IsDefCustom()) { - return 0; - } + QDomNodeList tags = elementsByTagName(TagGradation); + if (tags.size() == 0) + { + return 0; + } - const QDomNode domNode = tags.at(0); - const QDomElement domElement = domNode.toElement(); - if (domElement.isNull() == false) - { - return static_cast(GetParametrUInt(domElement, AttrDefSize, QStringLiteral("0"))); + const QDomNode domNode = tags.at(0); + const QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + return static_cast(GetParametrUInt(domElement, AttrDefSize, QStringLiteral("0"))); + } + else + { + return 0; + } } else {