Class: QgsMapLayerActionRegistry

A registry which tracks map layer actions.

QgsMapLayerActionRegistry is not usually directly created, but rather accessed through QgsGui.mapLayerActionRegistry().

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMapLayerActionRegistry

Base classes

QObject

Methods

addMapLayerAction

Adds a map layer action to the registry

defaultActionForLayer

Returns the default action for a layer

mapLayerActions

Returns the map layer actions which can run on the specified layer.

removeMapLayerAction

Removes a map layer action from the registry

setDefaultActionForLayer

Sets the default action for a layer

Signals

changed

Triggered when an action is added or removed from the registry

class qgis.gui.QgsMapLayerActionRegistry[source]

Bases: QObject

__init__(parent: QObject | None = None)

Constructor for QgsMapLayerActionRegistry.

QgsMapLayerActionRegistry is not usually directly created, but rather accessed through QgsGui.mapLayerActionRegistry().

Parameters:

parent (Optional[QObject] = None)

addMapLayerAction(self, action: QgsMapLayerAction | None)[source]

Adds a map layer action to the registry

Parameters:

action (Optional[QgsMapLayerAction])

signal changed[source]

Triggered when an action is added or removed from the registry

defaultActionForLayer(self, layer: QgsMapLayer | None) QgsMapLayerAction | None[source]

Returns the default action for a layer

Parameters:

layer (Optional[QgsMapLayer])

Return type:

Optional[QgsMapLayerAction]

mapLayerActions(self, layer: QgsMapLayer | None, targets: Qgis.MapLayerActionTargets | Qgis.MapLayerActionTarget = Qgis.MapLayerActionTarget.AllActions, context: QgsMapLayerActionContext = QgsMapLayerActionContext()) List[QgsMapLayerAction]

Returns the map layer actions which can run on the specified layer.

The context argument was added in QGIS 3.30.

Parameters:
Return type:

List[QgsMapLayerAction]

removeMapLayerAction(self, action: QgsMapLayerAction | None) bool[source]

Removes a map layer action from the registry

Parameters:

action (Optional[QgsMapLayerAction])

Return type:

bool

setDefaultActionForLayer(self, layer: QgsMapLayer | None, action: QgsMapLayerAction | None)[source]

Sets the default action for a layer

Parameters: