QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsreport.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsreport.cpp
3 --------------------
4 begin : December 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#include "qgsreport.h"
18
19#include "qgslayout.h"
20
21#include "moc_qgsreport.cpp"
22
24
25QgsReport::QgsReport( QgsProject *project )
26 : QgsAbstractReportSection( nullptr )
27 , mProject( project )
28{}
29
30QIcon QgsReport::icon() const
31{
32 return QgsApplication::getThemeIcon( QStringLiteral( "mIconReport.svg" ) );
33}
34
35QgsReport *QgsReport::clone() const
36{
37 auto copy = std::make_unique< QgsReport >( mProject );
38 copyCommonProperties( copy.get() );
39 return copy.release();
40}
41
42void QgsReport::setName( const QString &name )
43{
44 mName = name;
45 emit nameChanged( mName );
46}
47
48QDomElement QgsReport::writeLayoutXml( QDomDocument &document, const QgsReadWriteContext &context ) const
49{
50 QDomElement element = document.createElement( QStringLiteral( "Report" ) );
51 writeXml( element, document, context );
52 element.setAttribute( QStringLiteral( "name" ), mName );
53 return element;
54}
55
56bool QgsReport::readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context )
57{
58 const QDomNodeList sectionList = layoutElement.elementsByTagName( QStringLiteral( "Section" ) );
59 if ( sectionList.count() > 0 )
60 {
61 readXml( sectionList.at( 0 ).toElement(), document, context );
62 }
63 setName( layoutElement.attribute( QStringLiteral( "name" ) ) );
64 return true;
65}
66
67void QgsReport::updateSettings()
68{
69 reloadSettings();
70}
71
72bool QgsReport::layoutAccept( QgsStyleEntityVisitorInterface *visitor ) const
73{
74 return accept( visitor );
75}
76
77QgsMasterLayoutInterface::Type QgsReport::layoutType() const
78{
80}
81
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
A container for the context for various read/write operations on objects.
An interface for classes which can visit style entity (e.g.