22#include "moc_qgsmaplayeraction.cpp"
25 : QAction( icon, name, parent )
32 : QAction( icon, name, parent )
33 , mSingleLayer( true )
34 , mActionLayer( layer )
41 : QAction( icon, name, parent )
42 , mSpecificLayerType( true )
43 , mLayerType( layerType )
74 if ( !qobject_cast<QgsVectorLayer *>( layer )->isEditable() )
79 if ( !mSingleLayer && !mSpecificLayerType )
85 if ( mSingleLayer && layer == mActionLayer )
90 else if ( mSpecificLayerType && layer && layer->
type() == mLayerType )
@ EnabledOnlyWhenEditable
Action should be shown only for editable layers.
QFlags< MapLayerActionTarget > MapLayerActionTargets
Map layer action targets.
LayerType
Types of layers that can be added to a map.
QFlags< MapLayerActionFlag > MapLayerActionFlags
Map layer action flags.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
static QgsMapLayerActionRegistry * mapLayerActionRegistry()
Returns the global map layer action registry, used for registering map layer actions.
Encapsulates the context in which a QgsMapLayerAction action is executed.
bool removeMapLayerAction(QgsMapLayerAction *action)
Removes a map layer action from the registry.
void triggeredForFeatureV2(QgsMapLayer *layer, const QgsFeature &feature, const QgsMapLayerActionContext &context)
Triggered when action has been run for a specific feature.
Q_DECL_DEPRECATED void triggeredForFeatures(QgsMapLayer *layer, const QList< QgsFeature > &featureList)
Triggered when action has been run for a specific list of features.
virtual Q_DECL_DEPRECATED bool canRunUsingLayer(QgsMapLayer *layer) const
Returns true if the action can run using the specified layer.
void triggeredForFeaturesV2(QgsMapLayer *layer, const QList< QgsFeature > &featureList, const QgsMapLayerActionContext &context)
Triggered when action has been run for a specific list of features.
Q_DECL_DEPRECATED void triggeredForFeature(QgsMapLayer *layer, const QgsFeature &feature)
Triggered when action has been run for a specific feature.
virtual Q_DECL_DEPRECATED void triggerForFeatures(QgsMapLayer *layer, const QList< QgsFeature > &featureList)
Triggers the action with the specified layer and list of feature.
Q_DECL_DEPRECATED void triggeredForLayer(QgsMapLayer *layer)
Triggered when action has been run for a specific layer.
virtual Q_DECL_DEPRECATED void triggerForLayer(QgsMapLayer *layer)
Triggers the action with the specified layer.
void triggeredForLayerV2(QgsMapLayer *layer, const QgsMapLayerActionContext &context)
Triggered when action has been run for a specific layer.
bool isEnabledOnlyWhenEditable() const
Returns true if the action is only enabled for layers in editable mode.
~QgsMapLayerAction() override
QgsMapLayerAction(const QString &name, QObject *parent, Qgis::MapLayerActionTargets targets=Qgis::MapLayerActionTarget::AllActions, const QIcon &icon=QIcon(), Qgis::MapLayerActionFlags flags=Qgis::MapLayerActionFlags())
Creates a map layer action which can run on any layer.
Qgis::MapLayerActionFlags flags() const
Layer behavior flags.
virtual Q_DECL_DEPRECATED void triggerForFeature(QgsMapLayer *layer, const QgsFeature &feature)
Triggers the action with the specified layer and feature.
Base class for all map layer types.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH