Class: QgsLayoutItemGuiRegistry¶
- class qgis.gui.QgsLayoutItemGuiRegistry¶
Bases:
PyQt5.QtCore.QObject
Registry of available layout item GUI behavior.
QgsLayoutItemGuiRegistry
is not usually directly created, but rather accessed throughQgsGui.layoutItemGuiRegistry()
.This acts as a companion to
QgsLayoutItemRegistry
, handling only the components related to the GUI behavior of layout items.QgsLayoutItemGuiRegistry(parent: QObject = None) Creates a new empty item GUI registry.
QgsLayoutItemGuiRegistry
is not usually directly created, but rather accessed throughQgsGui.layoutItemGuiRegistry()
.Methods
Registers a new item group with the registry.
Registers the gui metadata for a new layout item type.
Creates a new instance of a layout item given the item metadata
metadataId
, targetlayout
.Creates a new instance of a layout item configuration widget for the specified
item
.Returns a reference to the item group with matching
id
.Returns the metadata for the specified item
metadataId
.Returns a list of available item metadata ids handled by the registry.
Returns the GUI item metadata ID which corresponds to the specified layout item
type
.Called when a newly created item of the associated metadata
metadataId
has been added to a layout.Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- addItemGroup(self, group: QgsLayoutItemGuiGroup) bool ¶
Registers a new item group with the registry. This must be done before calling
addLayoutItemGuiMetadata()
for any item types associated with the group.Returns
True
if group was added, orFalse
if group could not be added (e.g. due to duplicate id value).See also
- Parameters:
group (QgsLayoutItemGuiGroup) –
- Return type:
bool
- addLayoutItemGuiMetadata(self, metadata: QgsLayoutItemAbstractGuiMetadata) bool ¶
Registers the gui metadata for a new layout item type. Takes ownership of the metadata instance.
- Parameters:
metadata (QgsLayoutItemAbstractGuiMetadata) –
- Return type:
bool
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- createItem(self, metadataId: int, layout: QgsLayout) QgsLayoutItem ¶
Creates a new instance of a layout item given the item metadata
metadataId
, targetlayout
.- Parameters:
metadataId (int) –
layout (QgsLayout) –
- Return type:
- createItemWidget(self, item: QgsLayoutItem) QgsLayoutItemBaseWidget ¶
Creates a new instance of a layout item configuration widget for the specified
item
.- Parameters:
item (QgsLayoutItem) –
- Return type:
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- itemGroup(self, id: str) QgsLayoutItemGuiGroup ¶
Returns a reference to the item group with matching
id
.See also
- Parameters:
id (str) –
- Return type:
- itemMetadata(self, metadataId: int) QgsLayoutItemAbstractGuiMetadata ¶
Returns the metadata for the specified item
metadataId
. ReturnsNone
if a correspondingmetadataId
was not found in the registry.- Parameters:
metadataId (int) –
- Return type:
- itemMetadataIds(self) List[int] ¶
Returns a list of available item metadata ids handled by the registry.
- Return type:
List[int]
- metadataIdForItemType(self, type: int) int ¶
Returns the GUI item metadata ID which corresponds to the specified layout item
type
.In the case that multiple GUI metadata classes exist for a single layout item
type
then only the first encountered GUI metadata ID will be returned.Returns -1 if no matching metadata is found in the GUI registry.
New in version 3.18.
- Parameters:
type (int) –
- Return type:
int
- newItemAddedToLayout(self, metadataId: int, item: QgsLayoutItem, properties: Dict[str, Any] = {})¶
Called when a newly created item of the associated metadata
metadataId
has been added to a layout.This is only called for additions which result from GUI operations - i.e. it is not called for items added from templates.
Since QGIS 3.18 the optional
properties
argument can be used to pass custom properties to theQgsLayoutItemGuiMetadata.newItemAddedToLayout()
function.- Parameters:
metadataId (int) –
item (QgsLayoutItem) –
properties (Dict[str) –
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- timerEvent(self, QTimerEvent)¶
- typeAdded¶
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