QGIS API Documentation 3.99.0-Master (357b655ed83)
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 <QString>
22
23#include "moc_qgsreport.cpp"
24
25using namespace Qt::StringLiterals;
26
28
29QgsReport::QgsReport( QgsProject *project )
30 : QgsAbstractReportSection( nullptr )
31 , mProject( project )
32{}
33
34QIcon QgsReport::icon() const
35{
36 return QgsApplication::getThemeIcon( u"mIconReport.svg"_s );
37}
38
39QgsReport *QgsReport::clone() const
40{
41 auto copy = std::make_unique< QgsReport >( mProject );
42 copyCommonProperties( copy.get() );
43 return copy.release();
44}
45
46void QgsReport::setName( const QString &name )
47{
48 mName = name;
49 emit nameChanged( mName );
50}
51
52QDomElement QgsReport::writeLayoutXml( QDomDocument &document, const QgsReadWriteContext &context ) const
53{
54 QDomElement element = document.createElement( u"Report"_s );
55 writeXml( element, document, context );
56 element.setAttribute( u"name"_s, mName );
57 return element;
58}
59
60bool QgsReport::readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context )
61{
62 const QDomNodeList sectionList = layoutElement.elementsByTagName( u"Section"_s );
63 if ( sectionList.count() > 0 )
64 {
65 readXml( sectionList.at( 0 ).toElement(), document, context );
66 }
67 setName( layoutElement.attribute( u"name"_s ) );
68 return true;
69}
70
71void QgsReport::updateSettings()
72{
73 reloadSettings();
74}
75
76bool QgsReport::layoutAccept( QgsStyleEntityVisitorInterface *visitor ) const
77{
78 return accept( visitor );
79}
80
81QgsMasterLayoutInterface::Type QgsReport::layoutType() const
82{
84}
85
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:113
A container for the context for various read/write operations on objects.
An interface for classes which can visit style entity (e.g.