Class: QgsLayoutItemRegistry

Registry of available layout item types.

QgsLayoutItemRegistry is not usually directly created, but rather accessed through QgsApplication.layoutItemRegistry().

A companion class, QgsLayoutItemGuiRegistry, handles the GUI behavior of layout items.

Class Hierarchy

Inheritance diagram of qgis.core.QgsLayoutItemRegistry

Base classes

QObject

Methods

addLayoutItemType

Registers a new layout item type.

addLayoutMultiFrameType

Registers a new layout multiframe type.

createItem

Creates a new instance of a layout item given the item type, and target layout.

createMultiFrame

Creates a new instance of a layout multiframe given the multiframe type, and target layout.

itemMetadata

Returns the metadata for the specified item type.

itemTypes

Returns a map of available item types to translated name.

multiFrameMetadata

Returns the metadata for the specified multiframe type.

populate

Populates the registry with standard item types.

removeLayoutItemType

Unregisters a layout item type.

removeLayoutMultiFrameType

Unregisters a layout multiframe type.

resolvePaths

Resolve paths in properties of a particular symbol layer.

Signals

multiFrameTypeAdded

Emitted whenever a new multiframe type is added to the registry, with the specified type and visible name.

multiFrameTypeRemoved

Emitted whenever an multiframe type is removed from the registry with the specified type.

typeAdded

Emitted whenever a new item type is added to the registry, with the specified type and visible name.

typeRemoved

Emitted whenever an item type is removed from the registry with the specified type.

Attributes

Layout3DMap

LayoutAttributeTable

LayoutElevationProfile

LayoutFrame

LayoutGroup

LayoutHtml

LayoutItem

LayoutLabel

LayoutLegend

LayoutManualTable

LayoutMap

LayoutMarker

LayoutPage

LayoutPicture

LayoutPolygon

LayoutPolyline

LayoutScaleBar

LayoutShape

LayoutTextTable

PluginItem

class qgis.core.QgsLayoutItemRegistry[source]

Bases: QObject

__init__(parent: QObject | None = None)

Creates a new empty item registry.

QgsLayoutItemRegistry is not usually directly created, but rather accessed through QgsApplication.layoutItemRegistry().

See also

populate()

Parameters:

parent (Optional[QObject] = None)

class ItemType

Bases: int

Layout3DMap = 65651
LayoutAttributeTable = 65649
LayoutElevationProfile = 65654
LayoutFrame = 65647
LayoutGroup = 65637
LayoutHtml = 65648
LayoutItem = 65636
LayoutLabel = 65641
LayoutLegend = 65642
LayoutManualTable = 65652
LayoutMap = 65639
LayoutMarker = 65653
LayoutPage = 65638
LayoutPicture = 65640
LayoutPolygon = 65644
LayoutPolyline = 65645
LayoutScaleBar = 65646
LayoutShape = 65643
LayoutTextTable = 65650
PluginItem = 75650
addLayoutItemType(self, metadata: QgsLayoutItemAbstractMetadata | None) bool[source]

Registers a new layout item type. Takes ownership of the metadata instance.

Parameters:

metadata (Optional[QgsLayoutItemAbstractMetadata])

Return type:

bool

addLayoutMultiFrameType(self, metadata: QgsLayoutMultiFrameAbstractMetadata | None) bool[source]

Registers a new layout multiframe type. Takes ownership of the metadata instance.

Parameters:

metadata (Optional[QgsLayoutMultiFrameAbstractMetadata])

Return type:

bool

createItem(self, type: int, layout: QgsLayout | None) QgsLayoutItem | None[source]

Creates a new instance of a layout item given the item type, and target layout.

Parameters:
Return type:

Optional[QgsLayoutItem]

createMultiFrame(self, type: int, layout: QgsLayout | None) QgsLayoutMultiFrame | None[source]

Creates a new instance of a layout multiframe given the multiframe type, and target layout.

See also

createItem()

Parameters:
Return type:

Optional[QgsLayoutMultiFrame]

itemMetadata(self, type: int) QgsLayoutItemAbstractMetadata | None[source]

Returns the metadata for the specified item type. Returns None if a corresponding type was not found in the registry.

Parameters:

type (int)

Return type:

Optional[QgsLayoutItemAbstractMetadata]

itemTypes(self) Dict[int, str]

Returns a map of available item types to translated name.

Return type:

Dict[int, str]

multiFrameMetadata(self, type: int) QgsLayoutMultiFrameAbstractMetadata | None[source]

Returns the metadata for the specified multiframe type. Returns None if a corresponding type was not found in the registry.

See also

itemMetadata()

Parameters:

type (int)

Return type:

Optional[QgsLayoutMultiFrameAbstractMetadata]

signal multiFrameTypeAdded(type: int, name: str)[source]

Emitted whenever a new multiframe type is added to the registry, with the specified type and visible name.

Parameters:
  • type (int)

  • name (str)

signal multiFrameTypeRemoved(type: int)[source]

Emitted whenever an multiframe type is removed from the registry with the specified type.

Added in version 4.0.

Parameters:

type (int)

populate(self) bool[source]

Populates the registry with standard item types. If called on a non-empty registry then this will have no effect and will return False.

Return type:

bool

removeLayoutItemType(self, typeId: int) bool[source]

Unregisters a layout item type.

Added in version 4.0.

Parameters:

typeId (int)

Return type:

bool

removeLayoutItemType(self, metadata: QgsLayoutItemAbstractMetadata | None) bool[source]

Unregisters a layout item type.

The metadata object will be deleted and should not be used after this call.

Added in version 4.0.

Parameters:

metadata (Optional[QgsLayoutItemAbstractMetadata])

Return type:

bool

removeLayoutMultiFrameType(self, typeId: int) bool[source]

Unregisters a layout multiframe type.

Added in version 4.0.

Parameters:

typeId (int)

Return type:

bool

removeLayoutMultiFrameType(self, metadata: QgsLayoutMultiFrameAbstractMetadata | None) bool[source]

Unregisters a layout multiframe type.

The metadata object will be deleted and should not be used after this call.

Added in version 4.0.

Parameters:

metadata (Optional[QgsLayoutMultiFrameAbstractMetadata])

Return type:

bool

resolvePaths(self, type: int, properties: Dict[str, Any], pathResolver: QgsPathResolver, saving: bool)[source]

Resolve paths in properties of a particular symbol layer. This normally means converting relative paths to absolute paths when loading and converting absolute paths to relative paths when saving.

Parameters:
  • type (int)

  • properties (Dict[str, Any])

  • pathResolver (QgsPathResolver)

  • saving (bool)

signal typeAdded(type: int, name: str)[source]

Emitted whenever a new item type is added to the registry, with the specified type and visible name.

Parameters:
  • type (int)

  • name (str)

signal typeRemoved(type: int)[source]

Emitted whenever an item type is removed from the registry with the specified type.

Added in version 4.0.

Parameters:

type (int)