QGIS API Documentation  3.2.0-Bonn (bc43194)
qgslayoutmanager.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutmanager.h
3  ------------------
4  Date : January 2017
5  Copyright : (C) 2017 Nyall Dawson
6  Email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSLAYOUTMANAGER_H
17 #define QGSLAYOUTMANAGER_H
18 
19 #include "qgis_core.h"
20 #include "qgis.h"
22 #include <QObject>
23 
24 class QgsProject;
25 class QgsPrintLayout;
26 
42 class CORE_EXPORT QgsLayoutManager : public QObject
43 {
44  Q_OBJECT
45 
46  public:
47 
52  explicit QgsLayoutManager( QgsProject *project SIP_TRANSFERTHIS = nullptr );
53 
54  ~QgsLayoutManager() override;
55 
63  bool addLayout( QgsMasterLayoutInterface *layout SIP_TRANSFER );
64 
74  bool removeLayout( QgsMasterLayoutInterface *layout );
75 
80  void clear();
81 
85  QList< QgsMasterLayoutInterface * > layouts() const;
86 
90  QList< QgsPrintLayout * > printLayouts() const;
91 
96  QgsMasterLayoutInterface *layoutByName( const QString &name ) const;
97 
103  bool readXml( const QDomElement &element, const QDomDocument &doc );
104 
109  QDomElement writeXml( QDomDocument &doc ) const;
110 
116  QgsMasterLayoutInterface *duplicateLayout( const QgsMasterLayoutInterface *layout, const QString &newName );
117 
122  QString generateUniqueTitle( QgsMasterLayoutInterface::Type type = QgsMasterLayoutInterface::PrintLayout ) const;
123 
124  signals:
125 
127  void layoutAboutToBeAdded( const QString &name );
128 
130  void layoutAdded( const QString &name );
131 
133  void layoutRemoved( const QString &name );
134 
136  void layoutAboutToBeRemoved( const QString &name );
137 
139  void layoutRenamed( QgsMasterLayoutInterface *layout, const QString &newName );
140 
141  private:
142 
143  QgsProject *mProject = nullptr;
144 
145  QList< QgsMasterLayoutInterface * > mLayouts;
146 
147 };
148 
149 #endif // QGSLAYOUTMANAGER_H
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:46
#define SIP_TRANSFER
Definition: qgis_sip.h:36
Reads and writes project states.
Definition: qgsproject.h:85
Manages storage of a set of layouts.
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)