Class: QgsLayoutManager¶
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.
Class Hierarchy¶
Base classes¶
Manages storage of a set of objects attached to a |
|
- class qgis.core.QgsLayoutManager[source]¶
Bases:
QgsProjectStoredObjectManagerBase- __init__(project: QgsProject | None = None)
Constructor for QgsLayoutManager. The project will become the parent object for this manager.
- Parameters:
project (Optional[QgsProject] = None)
- accept(self, visitor: QgsStyleEntityVisitorInterface | None) bool[source]¶
Accepts the specified style entity
visitor, causing it to visit all style entities associated within the contained layouts.Returns
Trueif the visitor should continue visiting other objects, orFalseif visiting should be canceled.Added in version 3.10.
- Parameters:
visitor (Optional[QgsStyleEntityVisitorInterface])
- Return type:
bool
- addLayout(self, layout: QgsMasterLayoutInterface | None) bool[source]¶
Adds a
layoutto the manager. Ownership of the layout is transferred to the manager. ReturnsTrueif the addition was successful, orFalseif the layout could not be added (eg as a result of a duplicate layout name).See also
See also
- Parameters:
layout (Optional[QgsMasterLayoutInterface])
- Return type:
bool
- duplicateLayout(self, layout: QgsMasterLayoutInterface | None, newName: str | None) QgsMasterLayoutInterface | None[source]¶
Duplicates an existing
layoutfrom the manager. The new layout will automatically be stored in the manager. Returns the new layout if duplication was successful.- Parameters:
layout (Optional[QgsMasterLayoutInterface])
newName (Optional[str])
- Return type:
Optional[QgsMasterLayoutInterface]
- generateUniqueTitle(self, type: QgsMasterLayoutInterface.Type = QgsMasterLayoutInterface.PrintLayout) str[source]¶
Generates a unique title for a new layout of the specified
type, which does not clash with any already contained by the manager.- Parameters:
type (QgsMasterLayoutInterface.Type = QgsMasterLayoutInterface.PrintLayout)
- Return type:
str
- signal layoutAboutToBeAdded[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal layoutAboutToBeRemoved[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal layoutAdded[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- layoutByName(self, name: str | None) QgsMasterLayoutInterface | None[source]¶
Returns the layout with a matching name, or
Noneif no matching layouts were found.- Parameters:
name (Optional[str])
- Return type:
Optional[QgsMasterLayoutInterface]
- signal layoutRemoved[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- signal layoutRenamed[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- layouts(self) List[QgsMasterLayoutInterface]¶
Returns a list of all layouts contained in the manager.
- Return type:
- printLayouts(self) List[QgsPrintLayout]¶
Returns a list of all print layouts contained in the manager.
- Return type:
- readXml(self, element: QDomElement, doc: QDomDocument) bool[source]¶
Reads the manager’s state from a DOM element, restoring all layouts present in the XML document.
See also
- Parameters:
element (QDomElement)
doc (QDomDocument)
- Return type:
bool
- removeLayout(self, layout: QgsMasterLayoutInterface | None) bool[source]¶
Removes a
layoutfrom the manager. The layout is deleted. ReturnsTrueif the removal was successful, orFalseif the removal failed (eg as a result of removing a layout which is not contained in the manager).See also
See also
See also
See also
- Parameters:
layout (Optional[QgsMasterLayoutInterface])
- Return type:
bool
- virtual setupObjectConnections(self, layout: QgsMasterLayoutInterface | None)[source]¶
- Parameters:
layout (Optional[QgsMasterLayoutInterface])