QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
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_sip.h"
23
24#include <QAbstractListModel>
25#include <QObject>
26#include <QSortFilterProxyModel>
27
28class QgsProject;
29class QgsPrintLayout;
31
45#ifdef SIP_RUN
46class CORE_EXPORT QgsLayoutManager : public QgsProjectStoredObjectManagerBase // for sip we skip to the base class and avoid the template difficulty
47{
48#else
49class CORE_EXPORT QgsLayoutManager : public QgsAbstractProjectStoredObjectManager< QgsMasterLayoutInterface >
50{
51#endif
52 Q_OBJECT
53
54 public:
55
60 explicit QgsLayoutManager( QgsProject *project SIP_TRANSFERTHIS = nullptr );
61
62 ~QgsLayoutManager() override;
63
72
83
88 void clear();
89
93 QList< QgsMasterLayoutInterface * > layouts() const;
94
98 QList< QgsPrintLayout * > printLayouts() const;
99
104 QgsMasterLayoutInterface *layoutByName( const QString &name ) const;
105
111 bool readXml( const QDomElement &element, const QDomDocument &doc );
112
117 QDomElement writeXml( QDomDocument &doc ) const;
118
124 QgsMasterLayoutInterface *duplicateLayout( const QgsMasterLayoutInterface *layout, const QString &newName );
125
131
141 bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
142
143 signals:
144
146 void layoutAboutToBeAdded( const QString &name );
147
149 void layoutAdded( const QString &name );
150
152 void layoutRemoved( const QString &name );
153
155 void layoutAboutToBeRemoved( const QString &name );
156
158 void layoutRenamed( QgsMasterLayoutInterface *layout, const QString &newName );
159
160 protected:
161
162 void setupObjectConnections( QgsMasterLayoutInterface *layout ) override;
163
164 private:
165
166
167};
168
169
170#endif // QGSLAYOUTMANAGER_H
Manages storage of a set of layouts.
bool readXml(const QDomElement &element, const QDomDocument &doc)
Reads the manager's state from a DOM element, restoring all layouts present in the XML document.
QgsLayoutManager(QgsProject *project=nullptr)
Constructor for QgsLayoutManager.
QList< QgsMasterLayoutInterface * > layouts() const
Returns a list of all layouts contained in the manager.
QList< QgsPrintLayout * > printLayouts() const
Returns a list of all print layouts contained in the manager.
void setupObjectConnections(QgsMasterLayoutInterface *layout) override
void layoutAboutToBeRemoved(const QString &name)
Emitted when a layout is about to be removed from the manager.
bool removeLayout(QgsMasterLayoutInterface *layout)
Removes a layout from the manager.
QgsMasterLayoutInterface * layoutByName(const QString &name) const
Returns the layout with a matching name, or nullptr if no matching layouts were found.
void clear()
Removes and deletes all layouts from the manager.
bool addLayout(QgsMasterLayoutInterface *layout)
Adds a layout to the manager.
void layoutAboutToBeAdded(const QString &name)
Emitted when a layout is about to be added to the manager.
bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified style entity visitor, causing it to visit all style entities associated within ...
void layoutRenamed(QgsMasterLayoutInterface *layout, const QString &newName)
Emitted when a layout is renamed.
void layoutRemoved(const QString &name)
Emitted when a layout was removed from the manager.
QDomElement writeXml(QDomDocument &doc) const
Returns a DOM element representing the state of the manager.
QString generateUniqueTitle(QgsMasterLayoutInterface::Type type=QgsMasterLayoutInterface::PrintLayout) const
Generates a unique title for a new layout of the specified type, which does not clash with any alread...
void layoutAdded(const QString &name)
Emitted when a layout has been added to the manager.
QgsMasterLayoutInterface * duplicateLayout(const QgsMasterLayoutInterface *layout, const QString &newName)
Duplicates an existing layout from the manager.
Interface for master layout type objects, such as print layouts and reports.
@ PrintLayout
Individual print layout (QgsPrintLayout).
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Manages storage of a set of objects attached to a QgsProject.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition qgsproject.h:109
An interface for classes which can visit style entity (e.g.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_TRANSFER
Definition qgis_sip.h:36