QGIS API Documentation 3.41.0-Master (d5b93354e9c)
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#include "moc_qgsreport.cpp"
19#include "qgslayout.h"
20
22
23QgsReport::QgsReport( QgsProject *project )
24 : QgsAbstractReportSection( nullptr )
25 , mProject( project )
26{}
27
28QIcon QgsReport::icon() const
29{
30 return QgsApplication::getThemeIcon( QStringLiteral( "mIconReport.svg" ) );
31}
32
33QgsReport *QgsReport::clone() const
34{
35 std::unique_ptr< QgsReport > copy = std::make_unique< QgsReport >( mProject );
36 copyCommonProperties( copy.get() );
37 return copy.release();
38}
39
40void QgsReport::setName( const QString &name )
41{
42 mName = name;
43 emit nameChanged( mName );
44}
45
46QDomElement QgsReport::writeLayoutXml( QDomDocument &document, const QgsReadWriteContext &context ) const
47{
48 QDomElement element = document.createElement( QStringLiteral( "Report" ) );
49 writeXml( element, document, context );
50 element.setAttribute( QStringLiteral( "name" ), mName );
51 return element;
52}
53
54bool QgsReport::readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context )
55{
56 const QDomNodeList sectionList = layoutElement.elementsByTagName( QStringLiteral( "Section" ) );
57 if ( sectionList.count() > 0 )
58 {
59 readXml( sectionList.at( 0 ).toElement(), document, context );
60 }
61 setName( layoutElement.attribute( QStringLiteral( "name" ) ) );
62 return true;
63}
64
65void QgsReport::updateSettings()
66{
67 reloadSettings();
68}
69
70bool QgsReport::layoutAccept( QgsStyleEntityVisitorInterface *visitor ) const
71{
72 return accept( visitor );
73}
74
75QgsMasterLayoutInterface::Type QgsReport::layoutType() const
76{
78}
79
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:107
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.