22 QgsReportSectionLayout::QgsReportSectionLayout( QgsAbstractReportSection *parent )
23 : QgsAbstractReportSection( parent )
26 QIcon QgsReportSectionLayout::icon()
const
31 QgsReportSectionLayout *QgsReportSectionLayout::clone()
const
33 std::unique_ptr< QgsReportSectionLayout > copy = qgis::make_unique< QgsReportSectionLayout >(
nullptr );
34 copyCommonProperties( copy.get() );
38 copy->mBody.reset( mBody->clone() );
43 copy->mBodyEnabled = mBodyEnabled;
45 return copy.release();
48 bool QgsReportSectionLayout::beginRender()
50 mExportedBody =
false;
51 return QgsAbstractReportSection::beginRender();
54 QgsLayout *QgsReportSectionLayout::nextBody(
bool &ok )
56 if ( !mExportedBody && mBody && mBodyEnabled )
69 void QgsReportSectionLayout::reloadSettings()
71 QgsAbstractReportSection::reloadSettings();
73 mBody->reloadSettings();
76 bool QgsReportSectionLayout::writePropertiesToElement( QDomElement &element, QDomDocument &doc,
const QgsReadWriteContext &context )
const
80 QDomElement bodyElement = doc.createElement( QStringLiteral(
"body" ) );
81 bodyElement.appendChild( mBody->writeXml( doc, context ) );
82 element.appendChild( bodyElement );
84 element.setAttribute( QStringLiteral(
"bodyEnabled" ), mBodyEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
88 bool QgsReportSectionLayout::readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &doc,
const QgsReadWriteContext &context )
90 const QDomElement bodyElement = element.firstChildElement( QStringLiteral(
"body" ) );
91 if ( !bodyElement.isNull() )
93 const QDomElement bodyLayoutElem = bodyElement.firstChild().toElement();
94 std::unique_ptr< QgsLayout > body = qgis::make_unique< QgsLayout >( project() );
95 body->readXml( bodyLayoutElem, doc, context );
96 mBody = std::move( body );
98 mBodyEnabled = element.attribute( QStringLiteral(
"bodyEnabled" ) ).toInt();