QgsPrintLayout class
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Contents
Base classes
- class QgsLayout
- Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
- class QgsMasterLayoutInterface
- Interface for master layout type objects, such as print layouts and reports.
Constructors, destructors, conversion operators
- QgsPrintLayout(QgsProject* project)
- Constructor for QgsPrintLayout.
Public functions
- auto atlas() -> QgsLayoutAtlas*
- Returns the print layout's atlas.
- auto clone() const -> QgsPrintLayout* override
- Creates a clone of the layout.
- auto createExpressionContext() const -> QgsExpressionContext override
- Creates an expression context relating to the layout's current state.
- auto icon() const -> QIcon override
- Returns an icon for the layout.
- auto layoutProject() const -> QgsProject* override
- The project associated with the layout.
-
auto layoutType() const -> QgsMasterLayoutInterface::
Type override - Returns the master layout type.
- auto name() const -> QString override
- Returns the layout's name.
- auto readLayoutXml(const QDomElement& layoutElement, const QDomDocument& document, const QgsReadWriteContext& context) -> bool override
- Sets the layout's state from a DOM element.
- auto readXml(const QDomElement& layoutElement, const QDomDocument& document, const QgsReadWriteContext& context) -> bool override
- Sets the collection's state from a DOM element.
- void setName(const QString& name) override
- Sets the layout's name.
- void updateSettings() override
- Refreshes the layout when global layout related options change.
- auto writeLayoutXml(QDomDocument& document, const QgsReadWriteContext& context) const -> QDomElement override
- Returns the layout's state encapsulated in a DOM element.
- auto writeXml(QDomDocument& document, const QgsReadWriteContext& context) const -> QDomElement override
- Returns the layout's state encapsulated in a DOM element.
Signals
- void nameChanged(const QString& name)
- Emitted when the layout's name is changed.
Function documentation
QgsPrintLayout* QgsPrintLayout:: clone() const override
Creates a clone of the layout.
Ownership of the returned layout is transferred to the caller.
QgsExpressionContext QgsPrintLayout:: createExpressionContext() const override
Creates an expression context relating to the layout's current state.
The context includes scopes for global, project, layout and layout context properties.
QgsProject* QgsPrintLayout:: layoutProject() const override
The project associated with the layout.
Used to get access to layers, map themes, relations and various other bits. It is never null.
QString QgsPrintLayout:: name() const override
Returns the layout's name.
bool QgsPrintLayout:: readLayoutXml(const QDomElement& layoutElement,
const QDomDocument& document,
const QgsReadWriteContext& context) override
Sets the layout's state from a DOM element.
layoutElement is the DOM node corresponding to the layout.
bool QgsPrintLayout:: readXml(const QDomElement& layoutElement,
const QDomDocument& document,
const QgsReadWriteContext& context) override
Sets the collection's state from a DOM element.
layoutElement is the DOM node corresponding to the layout.
void QgsPrintLayout:: setName(const QString& name) override
Sets the layout's name.
QDomElement QgsPrintLayout:: writeLayoutXml(QDomDocument& document,
const QgsReadWriteContext& context) const override
Returns the layout's state encapsulated in a DOM element.
QDomElement QgsPrintLayout:: writeXml(QDomDocument& document,
const QgsReadWriteContext& context) const override
Returns the layout's state encapsulated in a DOM element.
void QgsPrintLayout:: nameChanged(const QString& name) signal
Emitted when the layout's name is changed.