Class: QgsMapLayerAction¶
- class qgis.gui.QgsMapLayerAction¶
Bases:
PyQt5.QtWidgets.QAction
An action which can run on map layers The class can be used in two manners: * by instantiating it and connecting to its signals to perform an action * by subclassing and reimplementing its method (only since QGIS 3.18.2)
QgsMapLayerAction(name: str, parent: QObject, targets: Union[QgsMapLayerAction.Targets, QgsMapLayerAction.Target] = QgsMapLayerAction.AllActions, icon: QIcon = QIcon(), flags: Union[QgsMapLayerAction.Flags, QgsMapLayerAction.Flag] = QgsMapLayerAction.Flags()) 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] = QgsMapLayerAction.Flags()) Creates a map layer action which can run only on a specific layerQgsMapLayerAction(name: str, parent: QObject, layerType:
QgsMapLayerType
, targets: Union[QgsMapLayerAction.Targets, QgsMapLayerAction.Target] = QgsMapLayerAction.AllActions, icon: QIcon = QIcon(), flags: Union[QgsMapLayerAction.Flags, QgsMapLayerAction.Flag] = QgsMapLayerAction.Flags()) Creates a map layer action which can run on a specific type of layerMethods
True if action can run using the specified layer
Layer behavior flags.
Returns
True
if the action is only enabled for layers in editable mode.Define the targets of the action
Returns availibity of action
Triggers the action with the specified layer and feature.
Triggers the action with the specified layer and list of feature.
Triggers the action with the specified layer.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
Attributes
- AllActions = 7¶
- EnabledOnlyWhenEditable = 2¶
- class Flag¶
Bases:
int
- class Flags¶
- class Flags(Union[QgsMapLayerAction.Flags, QgsMapLayerAction.Flag])
- class Flags(QgsMapLayerAction.Flags)
Bases:
sip.wrapper
- baseClass¶
alias of
QgsMapLayerAction
- Layer = 1¶
- MultipleFeatures = 4¶
- SingleFeature = 2¶
- class Target¶
Bases:
int
- class Targets¶
- class Targets(Union[QgsMapLayerAction.Targets, QgsMapLayerAction.Target])
- class Targets(QgsMapLayerAction.Targets)
Bases:
sip.wrapper
- baseClass¶
alias of
QgsMapLayerAction
- canRunUsingLayer(self, layer: QgsMapLayer) bool ¶
True if action can run using the specified layer
- Parameters:
layer (QgsMapLayer) –
- Return type:
bool
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- disconnectNotify(self, QMetaMethod)¶
- event(self, QEvent) bool ¶
- flags(self) QgsMapLayerAction.Flags ¶
Layer behavior flags.
New in version 3.0.
- Return type:
- isEnabledOnlyWhenEditable(self) bool ¶
Returns
True
if the action is only enabled for layers in editable mode.New in version 3.0.
- Return type:
bool
- isSignalConnected(self, QMetaMethod) bool ¶
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setTargets(self, targets: QgsMapLayerAction.Targets | QgsMapLayerAction.Target)¶
Define the targets of the action
- Parameters:
targets (Union[QgsMapLayerAction.Targets) –
- targets(self) QgsMapLayerAction.Targets ¶
Returns availibity of action
- Return type:
- timerEvent(self, QTimerEvent)¶
- triggerForFeature(self, layer: QgsMapLayer, feature: QgsFeature)¶
Triggers the action with the specified layer and feature.
- Parameters:
layer (QgsMapLayer) –
feature (QgsFeature) –
- triggerForFeatures(self, layer: QgsMapLayer, featureList: Iterable[QgsFeature])¶
Triggers the action with the specified layer and list of feature.
- Parameters:
layer (QgsMapLayer) –
featureList (Iterable[QgsFeature]) –
- triggerForLayer(self, layer: QgsMapLayer)¶
Triggers the action with the specified layer.
- Parameters:
layer (QgsMapLayer) –
- triggeredForFeature¶
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
- triggeredForFeatures¶
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
- triggeredForLayer¶
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