Class: QgsLayoutManager¶
- class qgis.core.QgsLayoutManager¶
Bases:
PyQt5.QtCore.QObject
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 aQgsProject
viaQgsProject.layoutManager()
.QgsLayoutManager
retains ownership of all the layouts contained in the manager.New in version 3.0.
QgsLayoutManager(project:
QgsProject
= None) Constructor forQgsLayoutManager
. The project will become the parent object for this manager.Methods
Accepts the specified style entity
visitor
, causing it to visit all style entities associated within the contained layouts.Adds a
layout
to the manager.Removes and deletes all layouts from the manager.
Duplicates an existing
layout
from the manager.Generates a unique title for a new layout of the specified
type
, which does not clash with any already contained by the manager.Returns the layout with a matching name, or
None
if no matching layouts were found.Returns a list of all layouts contained in the manager.
Returns a list of all print layouts contained in the manager.
Reads the manager's state from a DOM element, restoring all layouts present in the XML document.
Removes a
layout
from the manager.Returns a DOM element representing the state of the manager.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- accept(self, visitor: QgsStyleEntityVisitorInterface) bool ¶
Accepts the specified style entity
visitor
, causing it to visit all style entities associated within the contained layouts.Returns
True
if the visitor should continue visiting other objects, orFalse
if visiting should be canceled.New in version 3.10.
- Parameters:
visitor (QgsStyleEntityVisitorInterface) –
- Return type:
bool
- addLayout(self, layout: QgsMasterLayoutInterface) bool ¶
Adds a
layout
to the manager. Ownership of the layout is transferred to the manager. ReturnsTrue
if the addition was successful, orFalse
if the layout could not be added (eg as a result of a duplicate layout name).See also
See also
- Parameters:
layout (QgsMasterLayoutInterface) –
- Return type:
bool
- childEvent(self, QChildEvent)¶
- clear(self)¶
Removes and deletes all layouts from the manager.
See also
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- duplicateLayout(self, layout: QgsMasterLayoutInterface, newName: str) QgsMasterLayoutInterface ¶
Duplicates an existing
layout
from the manager. The new layout will automatically be stored in the manager. Returns the new layout if duplication was successful.- Parameters:
layout (QgsMasterLayoutInterface) –
newName (str) –
- Return type:
- generateUniqueTitle(self, type: QgsMasterLayoutInterface.Type = QgsMasterLayoutInterface.PrintLayout) str ¶
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
- isSignalConnected(self, QMetaMethod) bool ¶
- layoutAboutToBeAdded¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- layoutAboutToBeRemoved¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- layoutAdded¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- layoutByName(self, name: str) QgsMasterLayoutInterface ¶
Returns the layout with a matching name, or
None
if no matching layouts were found.- Parameters:
name (str) –
- Return type:
- layoutRemoved¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- layoutRenamed¶
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.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- layouts(self) List[QgsMasterLayoutInterface] ¶
Returns a list of all layouts contained in the manager.
- Return type:
List[QgsMasterLayoutInterface]
- printLayouts(self) List[QgsPrintLayout] ¶
Returns a list of all print layouts contained in the manager.
- Return type:
List[QgsPrintLayout]
- readXml(self, element: QDomElement, doc: QDomDocument) bool ¶
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
- receivers(self, PYQT_SIGNAL) int ¶
- removeLayout(self, layout: QgsMasterLayoutInterface) bool ¶
Removes a
layout
from the manager. The layout is deleted. ReturnsTrue
if the removal was successful, orFalse
if 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 (QgsMasterLayoutInterface) –
- Return type:
bool
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- timerEvent(self, QTimerEvent)¶