Subgroup: Layout

Class: QgsLayoutManager

class qgis.core.QgsLayoutManager

Bases: PyQt5.QtCore.QObject

New in version 3.0: Manages storage of a set of layouts.

QgsLayoutManager handles the storage, serializing and deserializing of QgsLayouts. 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.

Note

Not available in Python bindings

Methods

addLayout Adds a layout to the manager.
blockSignals
childEvent
children
clear Removes and deletes all layouts from the manager.
connectNotify
customEvent
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
duplicateLayout Duplicates an existing layout from the manager.
dynamicPropertyNames
event
eventFilter
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
generateUniqueTitle Generates a unique title for a new layout of the specified type, which does not clash with any already contained by the manager.
inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
layoutByName Returns the layout with a matching name, or None if no matching layouts were found.
layouts Returns a list of all layouts contained in the manager.
metaObject
moveToThread
objectName
parent
printLayouts Returns a list of all print layouts contained in the manager.
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
readXml Reads the manager’s state from a DOM element, restoring all layouts present in the XML document.
receivers
removeEventFilter
removeLayout Removes a layout from the manager.
saveAsTemplate Saves the composition with matching name in template format.
sender
senderSignalIndex
setObjectName
setParent
setProperty
signalsBlocked
startTimer
thread
timerEvent
tr
writeXml Returns a DOM element representing the state of the manager.

Attributes

destroyed destroyed(self, QObject = None) [signal]
layoutAboutToBeAdded Emitted when a layout is about to be added to the manager [signal]
layoutAboutToBeRemoved Emitted when a layout is about to be removed from the manager [signal]
layoutAdded Emitted when a layout has been added to the manager [signal]
layoutRemoved Emitted when a layout was removed from the manager [signal]
layoutRenamed Emitted when a layout is renamed [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
addLayout(self, layout: QgsMasterLayoutInterface) → bool

Adds a layout to the manager. Ownership of the layout is transferred to the manager. Returns true if the addition was successful, or false if the layout could not be added (eg as a result of a duplicate layout name).

See also

removeLayout()

See also

layoutAdded()

childEvent()
clear(self)

Removes and deletes all layouts from the manager.

See also

removeLayout()

connectNotify()
customEvent()
disconnectNotify()
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 new the layout if duplication was successful.

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.

isSignalConnected()
layoutAboutToBeAdded

Emitted when a layout is about to be added to the manager [signal]

layoutAboutToBeRemoved

Emitted when a layout is about to be removed from the manager [signal]

layoutAdded

Emitted when a layout has been added to the manager [signal]

layoutByName(self, name: str) → QgsMasterLayoutInterface

Returns the layout with a matching name, or None if no matching layouts were found.

layoutRemoved

Emitted when a layout was removed from the manager [signal]

layoutRenamed

Emitted when a layout is renamed [signal]

layouts(self) → object

Returns a list of all layouts contained in the manager.

printLayouts(self) → object

Returns a list of all print layouts contained in the manager.

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

writeXml()

receivers()
removeLayout(self, layout: QgsMasterLayoutInterface) → bool

Removes a layout from the manager. The layout is deleted. Returns true if the removal was successful, or false if the removal failed (eg as a result of removing a layout which is not contained in the manager).

See also

addLayout()

See also

layoutRemoved()

See also

clear()

saveAsTemplate(self, name: str, doc: QDomDocument) → bool

Saves the composition with matching name in template format. Returns true if save was successful.

sender()
senderSignalIndex()
timerEvent()
writeXml(self, doc: QDomDocument) → QDomElement

Returns a DOM element representing the state of the manager.

See also

readXml()