QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Signals | Public Member Functions | List of all members
QgsLayoutManager Class Reference

Manages storage of a set of layouts. More...

#include <qgslayoutmanager.h>

Inheritance diagram for QgsLayoutManager:
Inheritance graph
[legend]

Signals

void layoutAboutToBeAdded (const QString &name)
 Emitted when a layout is about to be added to the manager. More...
 
void layoutAboutToBeRemoved (const QString &name)
 Emitted when a layout is about to be removed from the manager. More...
 
void layoutAdded (const QString &name)
 Emitted when a layout has been added to the manager. More...
 
void layoutRemoved (const QString &name)
 Emitted when a layout was removed from the manager. More...
 
void layoutRenamed (QgsMasterLayoutInterface *layout, const QString &newName)
 Emitted when a layout is renamed. More...
 

Public Member Functions

 QgsLayoutManager (QgsProject *project=nullptr)
 Constructor for QgsLayoutManager. More...
 
 ~QgsLayoutManager () override
 
bool addLayout (QgsMasterLayoutInterface *layout)
 Adds a layout to the manager. More...
 
void clear ()
 Removes and deletes all layouts from the manager. More...
 
QgsMasterLayoutInterfaceduplicateLayout (const QgsMasterLayoutInterface *layout, const QString &newName)
 Duplicates an existing layout from the manager. More...
 
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 already contained by the manager. More...
 
QgsMasterLayoutInterfacelayoutByName (const QString &name) const
 Returns the layout with a matching name, or nullptr if no matching layouts were found. More...
 
QList< QgsMasterLayoutInterface * > layouts () const
 Returns a list of all layouts contained in the manager. More...
 
QList< QgsPrintLayout * > printLayouts () const
 Returns a list of all print layouts contained in the manager. More...
 
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. More...
 
bool removeLayout (QgsMasterLayoutInterface *layout)
 Removes a layout from the manager. More...
 
QDomElement writeXml (QDomDocument &doc) const
 Returns a DOM element representing the state of the manager. More...
 

Detailed Description

Manages storage of a set of layouts.

QgsLayoutManager handles the storage, serializing and deserializing of print layouts and reports. Usually this class is not constructed directly, but rather accessed through a QgsProject via QgsProject::layoutManager().

QgsLayoutManager retains ownership of all the layouts contained in the manager.

Since
QGIS 3.0

Definition at line 42 of file qgslayoutmanager.h.

Constructor & Destructor Documentation

QgsLayoutManager::QgsLayoutManager ( QgsProject project = nullptr)
explicit

Constructor for QgsLayoutManager.

The project will become the parent object for this manager.

Definition at line 26 of file qgslayoutmanager.cpp.

QgsLayoutManager::~QgsLayoutManager ( )
override

Definition at line 33 of file qgslayoutmanager.cpp.

Member Function Documentation

bool QgsLayoutManager::addLayout ( QgsMasterLayoutInterface layout)

Adds a layout to the manager.

Ownership of the layout is transferred to the manager. Returns true if the addition was successful, or false if the layout could not be added (eg as a result of a duplicate layout name).

See also
removeLayout()
layoutAdded()

Definition at line 38 of file qgslayoutmanager.cpp.

void QgsLayoutManager::clear ( )

Removes and deletes all layouts from the manager.

See also
removeLayout()

Definition at line 93 of file qgslayoutmanager.cpp.

QgsMasterLayoutInterface * QgsLayoutManager::duplicateLayout ( const QgsMasterLayoutInterface layout,
const QString &  newName 
)

Duplicates an existing layout from the manager.

The new layout will automatically be stored in the manager. Returns new the layout if duplication was successful.

Definition at line 256 of file qgslayoutmanager.cpp.

QString QgsLayoutManager::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 already contained by the manager.

Definition at line 279 of file qgslayoutmanager.cpp.

void QgsLayoutManager::layoutAboutToBeAdded ( const QString &  name)
signal

Emitted when a layout is about to be added to the manager.

void QgsLayoutManager::layoutAboutToBeRemoved ( const QString &  name)
signal

Emitted when a layout is about to be removed from the manager.

void QgsLayoutManager::layoutAdded ( const QString &  name)
signal

Emitted when a layout has been added to the manager.

QgsMasterLayoutInterface * QgsLayoutManager::layoutByName ( const QString &  name) const

Returns the layout with a matching name, or nullptr if no matching layouts were found.

Definition at line 121 of file qgslayoutmanager.cpp.

void QgsLayoutManager::layoutRemoved ( const QString &  name)
signal

Emitted when a layout was removed from the manager.

void QgsLayoutManager::layoutRenamed ( QgsMasterLayoutInterface layout,
const QString &  newName 
)
signal

Emitted when a layout is renamed.

QList< QgsMasterLayoutInterface * > QgsLayoutManager::layouts ( ) const

Returns a list of all layouts contained in the manager.

Definition at line 102 of file qgslayoutmanager.cpp.

QList< QgsPrintLayout * > QgsLayoutManager::printLayouts ( ) const

Returns a list of all print layouts contained in the manager.

Definition at line 107 of file qgslayoutmanager.cpp.

bool QgsLayoutManager::readXml ( const QDomElement &  element,
const QDomDocument &  doc 
)

Reads the manager's state from a DOM element, restoring all layouts present in the XML document.

See also
writeXml()

Definition at line 131 of file qgslayoutmanager.cpp.

bool QgsLayoutManager::removeLayout ( QgsMasterLayoutInterface layout)

Removes a layout from the manager.

The layout is deleted. Returns true if the removal was successful, or false if the removal failed (eg as a result of removing a layout which is not contained in the manager).

See also
addLayout()
layoutRemoved()
layoutAboutToBeRemoved()
clear()

Definition at line 76 of file qgslayoutmanager.cpp.

QDomElement QgsLayoutManager::writeXml ( QDomDocument &  doc) const

Returns a DOM element representing the state of the manager.

See also
readXml()

Definition at line 242 of file qgslayoutmanager.cpp.


The documentation for this class was generated from the following files: