Optimize size, rely more on default values for attributes.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-04-18 15:28:07 +03:00
parent 72eeae24e6
commit 35a0fd74e1
3 changed files with 18 additions and 5 deletions

View File

@ -3984,7 +3984,19 @@ void VPattern::SetIncrementFormula(const QString &name, const QString &text)
//---------------------------------------------------------------------------------------------------------------------
void VPattern::SetIncrementDescription(const QString &name, const QString &text)
{
SetIncrementAttribute(name, AttrDescription, text);
if (not text.isEmpty())
{
SetIncrementAttribute(name, AttrDescription, text);
}
else
{
QDomElement node = FindIncrement(name);
if (not node.isNull())
{
node.removeAttribute(AttrDescription);
emit patternChanged(false);
}
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -2285,7 +2285,7 @@ void VAbstractPattern::SetFMeasurements(QDomElement &element, const QVector<VFin
SetAttribute(tagFMeasurement, AttrName, m.name);
SetAttribute(tagFMeasurement, AttrFormula, m.formula);
SetAttribute(tagFMeasurement, AttrDescription, m.description);
SetAttributeOrRemoveIf(tagFMeasurement, AttrDescription, m.description, m.description.isEmpty());
element.appendChild(tagFMeasurement);
}

View File

@ -271,15 +271,16 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl
doc->SetAttribute(domElement, AttrVersion, QString().setNum(pieceVersion));
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(piece.GetMx()));
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(piece.GetMy()));
doc->SetAttribute(domElement, AttrInLayout, piece.IsInLayout());
doc->SetAttributeOrRemoveIf(domElement, AttrInLayout, piece.IsInLayout(), piece.IsInLayout());
doc->SetAttribute(domElement, AttrForbidFlipping, piece.IsForbidFlipping());
doc->SetAttribute(domElement, AttrForceFlipping, piece.IsForceFlipping());
doc->SetAttribute(domElement, AttrSeamAllowance, piece.IsSeamAllowance());
doc->SetAttributeOrRemoveIf(domElement, AttrSeamAllowance, piece.IsSeamAllowance(),
not piece.IsSeamAllowance());
doc->SetAttribute(domElement, AttrHideMainPath, piece.IsHideMainPath());
doc->SetAttributeOrRemoveIf(domElement, AttrSeamAllowanceBuiltIn, piece.IsSeamAllowanceBuiltIn(),
not piece.IsSeamAllowanceBuiltIn());
doc->SetAttribute(domElement, AttrWidth, piece.GetFormulaSAWidth());
doc->SetAttribute(domElement, AttrUnited, piece.IsUnited());
doc->SetAttributeOrRemoveIf(domElement, AttrUnited, piece.IsUnited(), not piece.IsUnited());
}
//---------------------------------------------------------------------------------------------------------------------