23QgsReportSectionLayout::QgsReportSectionLayout( QgsAbstractReportSection *parent )
24 : QgsAbstractReportSection( parent )
27QIcon QgsReportSectionLayout::icon()
const
32QgsReportSectionLayout *QgsReportSectionLayout::clone()
const
34 auto copy = std::make_unique< QgsReportSectionLayout >(
nullptr );
35 copyCommonProperties( copy.get() );
39 copy->mBody.reset( mBody->clone() );
44 copy->mBodyEnabled = mBodyEnabled;
46 return copy.release();
49bool QgsReportSectionLayout::beginRender()
51 mExportedBody =
false;
52 return QgsAbstractReportSection::beginRender();
55QgsLayout *QgsReportSectionLayout::nextBody(
bool &ok )
57 if ( !mExportedBody && mBody && mBodyEnabled )
70void QgsReportSectionLayout::reloadSettings()
72 QgsAbstractReportSection::reloadSettings();
74 mBody->reloadSettings();
77bool QgsReportSectionLayout::writePropertiesToElement( QDomElement &element, QDomDocument &doc,
const QgsReadWriteContext &context )
const
81 QDomElement bodyElement = doc.createElement( QStringLiteral(
"body" ) );
82 bodyElement.appendChild( mBody->writeXml( doc, context ) );
83 element.appendChild( bodyElement );
85 element.setAttribute( QStringLiteral(
"bodyEnabled" ), mBodyEnabled ? QStringLiteral(
"1" ) : QStringLiteral(
"0" ) );
89bool QgsReportSectionLayout::readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &doc,
const QgsReadWriteContext &context )
91 const QDomElement bodyElement = element.firstChildElement( QStringLiteral(
"body" ) );
92 if ( !bodyElement.isNull() )
94 const QDomElement bodyLayoutElem = bodyElement.firstChild().toElement();
95 auto body = std::make_unique< QgsLayout >( project() );
96 body->readXml( bodyLayoutElem, doc, context );
97 mBody = std::move( body );
99 mBodyEnabled = element.attribute( QStringLiteral(
"bodyEnabled" ) ).toInt();
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
A container for the context for various read/write operations on objects.