Use SetAttributeOrRemoveIf for margins.

This commit is contained in:
Roman Telezhynskyi 2021-05-26 10:17:02 +03:00
parent 53ed34c226
commit 45256ebdd9

View File

@ -169,10 +169,10 @@ void VPLayoutFileWriter::WritePiece(VPPiece *piece)
void VPLayoutFileWriter::WriteMargins(const QMarginsF &margins) void VPLayoutFileWriter::WriteMargins(const QMarginsF &margins)
{ {
writeStartElement(ML::TagMargin); writeStartElement(ML::TagMargin);
SetAttribute(ML::AttrLeft, margins.left()); SetAttributeOrRemoveIf<qreal>(ML::AttrLeft, margins.left(), [](qreal margin){return margin <= 0;});
SetAttribute(ML::AttrTop, margins.top()); SetAttributeOrRemoveIf<qreal>(ML::AttrTop, margins.top(), [](qreal margin){return margin <= 0;});
SetAttribute(ML::AttrRight, margins.right()); SetAttributeOrRemoveIf<qreal>(ML::AttrRight, margins.right(), [](qreal margin){return margin <= 0;});
SetAttribute(ML::AttrBottom, margins.bottom()); SetAttributeOrRemoveIf<qreal>(ML::AttrBottom, margins.bottom(), [](qreal margin){return margin <= 0;});
writeEndElement(); // margin writeEndElement(); // margin
} }