Class: QgsMapLayerActionRegistry¶
A registry which tracks map layer actions.
QgsMapLayerActionRegistry
is not usually directly created,
but rather accessed through QgsGui.mapLayerActionRegistry()
.
Class Hierarchy¶
Base classes¶
Methods
Adds a map layer action to the registry |
|
Returns the default action for a layer |
|
Returns the map layer actions which can run on the specified layer. |
|
Removes a map layer action from the registry |
|
Sets the default action for a layer |
Signals
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])
- 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:
layer (Optional[QgsMapLayer])
targets (Union[Qgis.MapLayerActionTargets, Qgis.MapLayerActionTarget] = Qgis.MapLayerActionTarget.AllActions)
context (
QgsMapLayerActionContext
= QgsMapLayerActionContext())
- 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:
layer (Optional[QgsMapLayer])
action (Optional[QgsMapLayerAction])