From 45256ebdd939030d7dd24d089f4bfc4a4812342f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 26 May 2021 10:17:02 +0300 Subject: [PATCH] Use SetAttributeOrRemoveIf for margins. --- src/app/puzzle/xml/vplayoutfilewriter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/puzzle/xml/vplayoutfilewriter.cpp b/src/app/puzzle/xml/vplayoutfilewriter.cpp index a9c0ad140..88a702471 100644 --- a/src/app/puzzle/xml/vplayoutfilewriter.cpp +++ b/src/app/puzzle/xml/vplayoutfilewriter.cpp @@ -169,10 +169,10 @@ void VPLayoutFileWriter::WritePiece(VPPiece *piece) void VPLayoutFileWriter::WriteMargins(const QMarginsF &margins) { writeStartElement(ML::TagMargin); - SetAttribute(ML::AttrLeft, margins.left()); - SetAttribute(ML::AttrTop, margins.top()); - SetAttribute(ML::AttrRight, margins.right()); - SetAttribute(ML::AttrBottom, margins.bottom()); + SetAttributeOrRemoveIf(ML::AttrLeft, margins.left(), [](qreal margin){return margin <= 0;}); + SetAttributeOrRemoveIf(ML::AttrTop, margins.top(), [](qreal margin){return margin <= 0;}); + SetAttributeOrRemoveIf(ML::AttrRight, margins.right(), [](qreal margin){return margin <= 0;}); + SetAttributeOrRemoveIf(ML::AttrBottom, margins.bottom(), [](qreal margin){return margin <= 0;}); writeEndElement(); // margin }