23using namespace Qt::StringLiterals;
27QgsReportSectionLayout::QgsReportSectionLayout( QgsAbstractReportSection *parent )
28 : QgsAbstractReportSection( parent )
31QIcon QgsReportSectionLayout::icon()
const
36QgsReportSectionLayout *QgsReportSectionLayout::clone()
const
38 auto copy = std::make_unique< QgsReportSectionLayout >(
nullptr );
39 copyCommonProperties( copy.get() );
43 copy->mBody.reset( mBody->clone() );
48 copy->mBodyEnabled = mBodyEnabled;
50 return copy.release();
53bool QgsReportSectionLayout::beginRender()
55 mExportedBody =
false;
56 return QgsAbstractReportSection::beginRender();
59QgsLayout *QgsReportSectionLayout::nextBody(
bool &ok )
61 if ( !mExportedBody && mBody && mBodyEnabled )
74void QgsReportSectionLayout::reloadSettings()
76 QgsAbstractReportSection::reloadSettings();
78 mBody->reloadSettings();
81bool QgsReportSectionLayout::writePropertiesToElement( QDomElement &element, QDomDocument &doc,
const QgsReadWriteContext &context )
const
85 QDomElement bodyElement = doc.createElement( u
"body"_s );
86 bodyElement.appendChild( mBody->writeXml( doc, context ) );
87 element.appendChild( bodyElement );
89 element.setAttribute( u
"bodyEnabled"_s, mBodyEnabled ? u
"1"_s : u
"0"_s );
93bool QgsReportSectionLayout::readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &doc,
const QgsReadWriteContext &context )
95 const QDomElement bodyElement = element.firstChildElement( u
"body"_s );
96 if ( !bodyElement.isNull() )
98 const QDomElement bodyLayoutElem = bodyElement.firstChild().toElement();
99 auto body = std::make_unique< QgsLayout >( project() );
100 body->readXml( bodyLayoutElem, doc, context );
101 mBody = std::move( body );
103 mBodyEnabled = element.attribute( u
"bodyEnabled"_s ).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.