QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
31 QDomDocument currentDoc;
34 const QDomElement elem =
writeXml( currentDoc, context );
35 currentDoc.appendChild( elem );
37 std::unique_ptr< QgsPrintLayout > newLayout = std::make_unique< QgsPrintLayout >(
project() );
39 newLayout->loadFromTemplate( currentDoc, context,
true, &ok );
45 return newLayout.release();
73 layoutElem.setAttribute( QStringLiteral(
"name" ), mName );
74 mAtlas->
writeXml( layoutElem, document, context );
83 const QDomElement atlasElem = layoutElement.firstChildElement( QStringLiteral(
"Atlas" ) );
84 mAtlas->
readXml( atlasElem, document, context );
86 setName( layoutElement.attribute( QStringLiteral(
"name" ) ) );
93 return writeXml( document, context );
98 return readXml( layoutElement, document, context );
QDomElement writeXml(QDomDocument &document, const QgsReadWriteContext &context) const override
Returns the layout's state encapsulated in a DOM element.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The class is used as a container of context for various read/write operations on other objects.
QgsExpressionContext createExpressionContext() const override
Creates an expression context relating to the layout's current state.
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern)...
virtual bool visitExit(const QgsStyleEntityVisitorInterface::Node &node)
Called when the visitor stops visiting a node.
@ PrintLayout
Individual print layout (QgsPrintLayout)
QgsExpressionContext createExpressionContext() const override
Creates an expression context relating to the layout's current state.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Print layout, a QgsLayout subclass for static or atlas-based layouts.
bool enabled() const
Returns whether the atlas generation is enabled.
virtual bool readXml(const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context)
Sets the collection's state from a DOM element.
@ PrintLayout
An individual print layout.
void nameChanged(const QString &name)
Emitted when the layout's name is changed.
bool readLayoutXml(const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets the layout's state from a DOM element.
void setDirty(bool b=true)
Flag the project as dirty (modified).
Contains information relating to a node (i.e.
bool readXml(const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets the collection's state from a DOM element.
QDomElement writeLayoutXml(QDomDocument &document, const QgsReadWriteContext &context) const override
Returns the layout's state encapsulated in a DOM element.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
virtual bool visitEnter(const QgsStyleEntityVisitorInterface::Node &node)
Called when the visitor starts visiting a node.
QgsProject * layoutProject() const override
The project associated with the layout.
bool writeXml(QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const override
Stores the objects's state in a DOM element.
QgsMasterLayoutInterface::Type layoutType() const override
Returns the master layout type.
virtual QDomElement writeXml(QDomDocument &document, const QgsReadWriteContext &context) const
Returns the layout's state encapsulated in a DOM element.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
QgsLayoutAtlas * atlas()
Returns the print layout's atlas.
bool readXml(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context) override
Sets the objects's state from a DOM element.
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
QgsProject * project() const
The project associated with the layout.
void setName(const QString &name) override
Sets the layout's name.
bool layoutAccept(QgsStyleEntityVisitorInterface *visitor) const override
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
Class used to render QgsLayout as an atlas, by iterating over the features from an associated vector ...
QgsPrintLayout * clone() const override
Creates a clone of the layout.
void updateSettings() override
Refreshes the layout when global layout related options change.
QIcon icon() const override
Returns an icon for the layout.
void reloadSettings()
Refreshes the layout when global layout related options change.
QgsPrintLayout(QgsProject *project)
Constructor for QgsPrintLayout.