QGIS API Documentation  3.0.2-Girona (307d082)
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 
43 class CORE_EXPORT QgsLayoutManager : public QObject
44 {
45  Q_OBJECT
46 
47  public:
48 
53  explicit QgsLayoutManager( QgsProject *project SIP_TRANSFERTHIS = nullptr );
54 
55  ~QgsLayoutManager() override;
56 
64  bool addLayout( QgsMasterLayoutInterface *layout SIP_TRANSFER );
65 
75  bool removeLayout( QgsMasterLayoutInterface *layout );
76 
81  void clear();
82 
86  QList< QgsMasterLayoutInterface * > layouts() const;
87 
91  QList< QgsPrintLayout * > printLayouts() const;
92 
97  QgsMasterLayoutInterface *layoutByName( const QString &name ) const;
98 
104  bool readXml( const QDomElement &element, const QDomDocument &doc );
105 
110  QDomElement writeXml( QDomDocument &doc ) const;
111 
117  QgsMasterLayoutInterface *duplicateLayout( const QgsMasterLayoutInterface *layout, const QString &newName );
118 
123  QString generateUniqueTitle( QgsMasterLayoutInterface::Type type = QgsMasterLayoutInterface::PrintLayout ) const;
124 
125  signals:
126 
128  void layoutAboutToBeAdded( const QString &name );
129 
131  void layoutAdded( const QString &name );
132 
134  void layoutRemoved( const QString &name );
135 
137  void layoutAboutToBeRemoved( const QString &name );
138 
140  void layoutRenamed( QgsMasterLayoutInterface *layout, const QString &newName );
141 
142  private:
143 
144  QgsProject *mProject = nullptr;
145 
146  QList< QgsMasterLayoutInterface * > mLayouts;
147 
148 };
149 
150 #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:82
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)