QGIS API Documentation 3.30.0-'s-Hertogenbosch (f186b8efe0)
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#include "qgslayout.h"
19
21
22QgsReport::QgsReport( QgsProject *project )
23 : QgsAbstractReportSection( nullptr )
24 , mProject( project )
25{}
26
27QIcon QgsReport::icon() const
28{
29 return QgsApplication::getThemeIcon( QStringLiteral( "mIconReport.svg" ) );
30}
31
32QgsReport *QgsReport::clone() const
33{
34 std::unique_ptr< QgsReport > copy = std::make_unique< QgsReport >( mProject );
35 copyCommonProperties( copy.get() );
36 return copy.release();
37}
38
39void QgsReport::setName( const QString &name )
40{
41 mName = name;
42 emit nameChanged( mName );
43}
44
45QDomElement QgsReport::writeLayoutXml( QDomDocument &document, const QgsReadWriteContext &context ) const
46{
47 QDomElement element = document.createElement( QStringLiteral( "Report" ) );
48 writeXml( element, document, context );
49 element.setAttribute( QStringLiteral( "name" ), mName );
50 return element;
51}
52
53bool QgsReport::readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context )
54{
55 const QDomNodeList sectionList = layoutElement.elementsByTagName( QStringLiteral( "Section" ) );
56 if ( sectionList.count() > 0 )
57 {
58 readXml( sectionList.at( 0 ).toElement(), document, context );
59 }
60 setName( layoutElement.attribute( QStringLiteral( "name" ) ) );
61 return true;
62}
63
64void QgsReport::updateSettings()
65{
66 reloadSettings();
67}
68
69bool QgsReport::layoutAccept( QgsStyleEntityVisitorInterface *visitor ) const
70{
71 return accept( visitor );
72}
73
74QgsMasterLayoutInterface::Type QgsReport::layoutType() const
75{
77}
78
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:105
The class is used as a container of context for various read/write operations on other objects.
An interface for classes which can visit style entity (e.g.