Fix wrong use of SetAttributeOrRemoveIf(). The remove condition must be
calculated not hardcoded. --HG-- branch : develop
This commit is contained in:
parent
3b1d753360
commit
0f226d6cdf
|
@ -4227,7 +4227,7 @@ void VPattern::SetDefCustomHeight(int value)
|
||||||
QDomElement domElement = domNode.toElement();
|
QDomElement domElement = domNode.toElement();
|
||||||
if (domElement.isNull() == false)
|
if (domElement.isNull() == false)
|
||||||
{
|
{
|
||||||
SetAttributeOrRemoveIf(domElement, AttrDefHeight, value, 0);
|
SetAttributeOrRemoveIf(domElement, AttrDefHeight, value, value == 0);
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4279,7 +4279,7 @@ void VPattern::SetDefCustomSize(int value)
|
||||||
QDomElement domElement = domNode.toElement();
|
QDomElement domElement = domNode.toElement();
|
||||||
if (domElement.isNull() == false)
|
if (domElement.isNull() == false)
|
||||||
{
|
{
|
||||||
SetAttributeOrRemoveIf(domElement, AttrDefSize, value, 0);
|
SetAttributeOrRemoveIf(domElement, AttrDefSize, value, value == 0);
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4308,7 +4308,7 @@ void VPattern::SetReadOnly(bool rOnly)
|
||||||
|
|
||||||
if (not pattern.isNull())
|
if (not pattern.isNull())
|
||||||
{
|
{
|
||||||
SetAttributeOrRemoveIf(pattern, AttrReadOnly, rOnly, false);
|
SetAttributeOrRemoveIf(pattern, AttrReadOnly, rOnly, not rOnly);
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -523,8 +523,9 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrNodeExcluded, node.IsExcluded(), false);
|
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrNodeExcluded, node.IsExcluded(), not node.IsExcluded());
|
||||||
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrCheckUniqueness, node.IsCheckUniqueness(), true);
|
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrCheckUniqueness, node.IsCheckUniqueness(),
|
||||||
|
node.IsCheckUniqueness());
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -581,7 +582,8 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
|
||||||
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
|
nod.removeAttribute(VAbstractPattern::AttrNodePassmarkAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrNodeShowSecondPassmark, node.IsShowSecondPassmark(), true);
|
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrNodeShowSecondPassmark, node.IsShowSecondPassmark(),
|
||||||
|
node.IsShowSecondPassmark());
|
||||||
|
|
||||||
return nod;
|
return nod;
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,7 +276,8 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl
|
||||||
doc->SetAttribute(domElement, AttrForceFlipping, piece.IsForceFlipping());
|
doc->SetAttribute(domElement, AttrForceFlipping, piece.IsForceFlipping());
|
||||||
doc->SetAttribute(domElement, AttrSeamAllowance, piece.IsSeamAllowance());
|
doc->SetAttribute(domElement, AttrSeamAllowance, piece.IsSeamAllowance());
|
||||||
doc->SetAttribute(domElement, AttrHideMainPath, piece.IsHideMainPath());
|
doc->SetAttribute(domElement, AttrHideMainPath, piece.IsHideMainPath());
|
||||||
doc->SetAttributeOrRemoveIf(domElement, AttrSeamAllowanceBuiltIn, piece.IsSeamAllowanceBuiltIn(), false);
|
doc->SetAttributeOrRemoveIf(domElement, AttrSeamAllowanceBuiltIn, piece.IsSeamAllowanceBuiltIn(),
|
||||||
|
not piece.IsSeamAllowanceBuiltIn());
|
||||||
doc->SetAttribute(domElement, AttrWidth, piece.GetFormulaSAWidth());
|
doc->SetAttribute(domElement, AttrWidth, piece.GetFormulaSAWidth());
|
||||||
doc->SetAttribute(domElement, AttrUnited, piece.IsUnited());
|
doc->SetAttribute(domElement, AttrUnited, piece.IsUnited());
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ void TogglePieceInLayout::Do(bool state)
|
||||||
QDomElement detail = doc->elementById(m_id, VAbstractPattern::TagDetail);
|
QDomElement detail = doc->elementById(m_id, VAbstractPattern::TagDetail);
|
||||||
if (detail.isElement())
|
if (detail.isElement())
|
||||||
{
|
{
|
||||||
doc->SetAttributeOrRemoveIf(detail, AttrInLayout, state, true);
|
doc->SetAttributeOrRemoveIf(detail, AttrInLayout, state, state);
|
||||||
|
|
||||||
VPiece det = m_data->DataPieces()->value(m_id);
|
VPiece det = m_data->DataPieces()->value(m_id);
|
||||||
det.SetInLayout(state);
|
det.SetInLayout(state);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user