Class: QgsMasterLayoutInterface

Interface for master layout type objects, such as print layouts and reports.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: clone(), icon(), layoutProject(), layoutType(), name(), readLayoutXml(), setName(), updateSettings(), writeLayoutXml()

Class Hierarchy

Inheritance diagram of qgis.core.QgsMasterLayoutInterface

Subclasses

QgsPrintLayout

Print layout, a QgsLayout subclass for static or atlas-based layouts.

QgsReport

Represents a report for use with the QgsLayout engine.

Abstract Methods

clone

Creates a clone of the layout.

icon

Returns an icon for the layout.

layoutProject

The project associated with the layout.

layoutType

Returns the master layout type.

name

Returns the layout's name.

readLayoutXml

Sets the layout's state from a DOM element.

setName

Sets the layout's name.

updateSettings

Refreshes the layout when global layout related options change.

writeLayoutXml

Returns the layout's state encapsulated in a DOM element.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsMasterLayoutInterface. See the FAQ for more details.

layoutAccept

Accepts the specified style entity visitor, causing it to visit all style entities associated with the layout.

Attributes

PrintLayout

Report

class qgis.core.QgsMasterLayoutInterface[source]

Bases: object

PrintLayout = 0
Report = 1
class Type

Bases: int

abstract clone(self) QgsMasterLayoutInterface | None[source]

Creates a clone of the layout. Ownership of the returned layout is transferred to the caller.

Return type:

Optional[QgsMasterLayoutInterface]

abstract icon(self) QIcon[source]

Returns an icon for the layout.

Return type:

QIcon

virtual layoutAccept(self, visitor: QgsStyleEntityVisitorInterface | None) bool[source]

Accepts the specified style entity visitor, causing it to visit all style entities associated with the layout.

Returns True if the visitor should continue visiting other objects, or False if visiting should be canceled.

Added in version 3.10.

Parameters:

visitor (Optional[QgsStyleEntityVisitorInterface])

Return type:

bool

abstract layoutProject(self) QgsProject | None[source]

The project associated with the layout. Used to get access to layers, map themes, relations and various other bits. It is never None.

Return type:

Optional[QgsProject]

abstract layoutType(self) QgsMasterLayoutInterface.Type[source]

Returns the master layout type.

Return type:

QgsMasterLayoutInterface.Type

abstract name(self) str[source]

Returns the layout’s name.

See also

setName()

Return type:

str

abstract readLayoutXml(self, layoutElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext) bool[source]

Sets the layout’s state from a DOM element. layoutElement is the DOM node corresponding to the layout.

See also

writeLayoutXml()

Parameters:
Return type:

bool

abstract setName(self, name: str | None)[source]

Sets the layout’s name.

See also

name()

Parameters:

name (Optional[str])

abstract updateSettings(self)[source]

Refreshes the layout when global layout related options change.

abstract writeLayoutXml(self, document: QDomDocument, context: QgsReadWriteContext) QDomElement[source]

Returns the layout’s state encapsulated in a DOM element.

See also

readLayoutXml()

Parameters:
Return type:

QDomElement