QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
59 explicit QgsLayoutManager( QgsProject *project SIP_TRANSFERTHIS = nullptr );
60
61 ~QgsLayoutManager() override;
62
71
82
87 void clear();
88
92 QList< QgsMasterLayoutInterface * > layouts() const;
93
97 QList< QgsPrintLayout * > printLayouts() const;
98
103 QgsMasterLayoutInterface *layoutByName( const QString &name ) const;
104
110 bool readXml( const QDomElement &element, const QDomDocument &doc );
111
116 QDomElement writeXml( QDomDocument &doc ) const;
117
123 QgsMasterLayoutInterface *duplicateLayout( const QgsMasterLayoutInterface *layout, const QString &newName );
124
130
140 bool accept( QgsStyleEntityVisitorInterface *visitor ) const;
141
142 signals:
143
145 void layoutAboutToBeAdded( const QString &name );
146
148 void layoutAdded( const QString &name );
149
151 void layoutRemoved( const QString &name );
152
154 void layoutAboutToBeRemoved( const QString &name );
155
157 void layoutRenamed( QgsMasterLayoutInterface *layout, const QString &newName );
158
159 protected:
160 void setupObjectConnections( QgsMasterLayoutInterface *layout ) override;
161
162 private:
163};
164
165
166#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:113
An interface for classes which can visit style entity (e.g.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_TRANSFER
Definition qgis_sip.h:35