Subgroup: Map

Class: QgsMapLayerAction

class qgis.gui.QgsMapLayerAction(name: str, parent: QObject, targets: Union[QgsMapLayerAction.Targets, QgsMapLayerAction.Target] = QgsMapLayerAction.AllActions, icon: QIcon = QIcon(), flags: Union[QgsMapLayerAction.Flags, QgsMapLayerAction.Flag] = 0)

Bases: PyQt5.QtWidgets.QAction

Creates a map layer action which can run on any layer

Note

using AllActions as a target probably does not make a lot of sense. This default action was settled for API compatibility reasons.

QgsMapLayerAction(name: str, parent: QObject, layer: QgsMapLayer, targets: Union[QgsMapLayerAction.Targets, QgsMapLayerAction.Target] = QgsMapLayerAction.AllActions, icon: QIcon = QIcon(), flags: Union[QgsMapLayerAction.Flags, QgsMapLayerAction.Flag] = 0) Creates a map layer action which can run only on a specific layer

QgsMapLayerAction(name: str, parent: QObject, layerType: QgsMapLayer.LayerType, targets: Union[QgsMapLayerAction.Targets, QgsMapLayerAction.Target] = QgsMapLayerAction.AllActions, icon: QIcon = QIcon(), flags: Union[QgsMapLayerAction.Flags, QgsMapLayerAction.Flag] = 0) Creates a map layer action which can run on a specific type of layer

An action which can run on map layers

Methods

canRunUsingLayer True if action can run using the specified layer
childEvent
connectNotify
customEvent
disconnectNotify
event
flags Layer behavior flags.
isEnabledOnlyWhenEditable Returns true if the action is only enabled for layers in editable mode.
isSignalConnected
receivers
sender
senderSignalIndex
setTargets Define the targets of the action
targets Returns availibity of action
timerEvent
triggerForFeature Triggers the action with the specified layer and feature.
triggerForFeatures Triggers the action with the specified layer and list of feature.
triggerForLayer Triggers the action with the specified layer.

Signals

triggeredForFeature Triggered when action has been run for a specific feature [signal]
triggeredForFeatures Triggered when action has been run for a specific list of features [signal]
triggeredForLayer Triggered when action has been run for a specific layer [signal]

Attributes

AllActions
EnabledOnlyWhenEditable
Layer
MultipleFeatures
SingleFeature
AllActions = 7
EnabledOnlyWhenEditable = 2
class Flag

Bases: int

class Flags

Bases: sip.wrapper

QgsMapLayerAction.Flags(Union[QgsMapLayerAction.Flags, QgsMapLayerAction.Flag]) QgsMapLayerAction.Flags(QgsMapLayerAction.Flags)

baseClass

alias of QgsMapLayerAction

Layer = 1
MultipleFeatures = 4
SingleFeature = 2
class Target

Bases: int

class Targets

Bases: sip.wrapper

QgsMapLayerAction.Targets(Union[QgsMapLayerAction.Targets, QgsMapLayerAction.Target]) QgsMapLayerAction.Targets(QgsMapLayerAction.Targets)

baseClass

alias of QgsMapLayerAction

canRunUsingLayer(self, layer: QgsMapLayer) → bool

True if action can run using the specified layer

childEvent()
connectNotify()
customEvent()
disconnectNotify()
event()
flags(self) → QgsMapLayerAction.Flags

Layer behavior flags.

New in version 3.0.

isEnabledOnlyWhenEditable(self) → bool

Returns true if the action is only enabled for layers in editable mode.

New in version 3.0.

isSignalConnected()
receivers()
sender()
senderSignalIndex()
setTargets(self, targets: Union[QgsMapLayerAction.Targets, QgsMapLayerAction.Target])

Define the targets of the action

targets(self) → QgsMapLayerAction.Targets

Returns availibity of action

timerEvent()
triggerForFeature(self, layer: QgsMapLayer, feature: QgsFeature)

Triggers the action with the specified layer and feature.

triggerForFeatures(self, layer: QgsMapLayer, featureList: Iterable[QgsFeature])

Triggers the action with the specified layer and list of feature.

triggerForLayer(self, layer: QgsMapLayer)

Triggers the action with the specified layer.

triggeredForFeature

Triggered when action has been run for a specific feature [signal]

triggeredForFeatures

Triggered when action has been run for a specific list of features [signal]

triggeredForLayer

Triggered when action has been run for a specific layer [signal]