Return 0 if default height/size is not custom.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-12 13:15:29 +02:00
parent e8a93ddc2b
commit abb7147bc8

View File

@ -2491,17 +2491,24 @@ void VPattern::SetDefCustom(bool value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VPattern::GetDefCustomHeight() const int VPattern::GetDefCustomHeight() const
{ {
QDomNodeList tags = elementsByTagName(TagGradation); if (IsDefCustom())
if (tags.size() == 0)
{ {
return 0; QDomNodeList tags = elementsByTagName(TagGradation);
} if (tags.size() == 0)
{
return 0;
}
const QDomNode domNode = tags.at(0); const QDomNode domNode = tags.at(0);
const QDomElement domElement = domNode.toElement(); const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false) if (domElement.isNull() == false)
{ {
return static_cast<int>(GetParametrUInt(domElement, AttrDefHeight, QStringLiteral("0"))); return static_cast<int>(GetParametrUInt(domElement, AttrDefHeight, QStringLiteral("0")));
}
else
{
return 0;
}
} }
else else
{ {
@ -2542,17 +2549,24 @@ void VPattern::SetDefCustomHeight(int value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VPattern::GetDefCustomSize() const int VPattern::GetDefCustomSize() const
{ {
QDomNodeList tags = elementsByTagName(TagGradation); if (IsDefCustom())
if (tags.size() == 0)
{ {
return 0; QDomNodeList tags = elementsByTagName(TagGradation);
} if (tags.size() == 0)
{
return 0;
}
const QDomNode domNode = tags.at(0); const QDomNode domNode = tags.at(0);
const QDomElement domElement = domNode.toElement(); const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false) if (domElement.isNull() == false)
{ {
return static_cast<int>(GetParametrUInt(domElement, AttrDefSize, QStringLiteral("0"))); return static_cast<int>(GetParametrUInt(domElement, AttrDefSize, QStringLiteral("0")));
}
else
{
return 0;
}
} }
else else
{ {