QGIS API Documentation  3.6.0-Noosa (5873452)
qgsmasterlayoutinterface.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutinterface.h
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 #ifndef QGSLAYOUTINTERFACE_H
17 #define QGSLAYOUTINTERFACE_H
18 
19 #include "qgis_core.h"
20 #include "qgis_sip.h"
21 #include <QString>
22 #include <QIcon>
23 #include <QDomElement>
24 
25 class QgsProject;
27 
28 #ifdef SIP_RUN
29 % ModuleHeaderCode
30 #include "qgsprintlayout.h"
31 #include "qgsreport.h"
32 % End
33 #endif
34 
41 class CORE_EXPORT QgsMasterLayoutInterface
42 {
43 
44 #ifdef SIP_RUN
46  switch ( sipCpp->layoutType() )
47  {
49  sipType = sipType_QgsPrintLayout;
50  *sipCppRet = static_cast<QgsPrintLayout *>( sipCpp );
51  break;
53  *sipCppRet = static_cast<QgsReport *>( sipCpp );
54  sipType = sipType_QgsReport;
55  break;
56  default:
57  sipType = NULL;
58  }
59  SIP_END
60 #endif
61 
62  public:
63 
65  enum Type
66  {
67  PrintLayout = 0,
68  Report = 1,
69  };
70 
71  virtual ~QgsMasterLayoutInterface() = default;
72 
77  virtual QgsMasterLayoutInterface *clone() const = 0 SIP_FACTORY;
78 
82  virtual QgsMasterLayoutInterface::Type layoutType() const = 0;
83 
88  virtual QString name() const = 0;
89 
93  virtual QIcon icon() const = 0;
94 
99  virtual void setName( const QString &name ) = 0;
100 
105  virtual QgsProject *layoutProject() const = 0;
106 
111  virtual QDomElement writeLayoutXml( QDomDocument &document, const QgsReadWriteContext &context ) const = 0;
112 
117  virtual bool readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context ) = 0;
118 
122  virtual void updateSettings() = 0;
123 };
124 
125 #endif //QGSLAYOUTINTERFACE_H
126 
127 
128 
The class is used as a container of context for various read/write operations on other objects...
#define SIP_END
Definition: qgis_sip.h:182
Reads and writes project states.
Definition: qgsproject.h:89
#define SIP_FACTORY
Definition: qgis_sip.h:69
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:165
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Interface for master layout type objects, such as print layouts and reports.
Individual print layout (QgsPrintLayout)