Skip to content

Commit

Permalink
make methods of QgsMapLayerAction virtual so the canRunUsingLayer can…
Browse files Browse the repository at this point in the history
… be fine tuned (#42613)
  • Loading branch information
3nids authored and nyalldawson committed Apr 6, 2021
1 parent 3fea7b6 commit 523510c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions python/gui/auto_generated/qgsmaplayeractionregistry.sip.in
Expand Up @@ -14,6 +14,9 @@ class QgsMapLayerAction : QAction
{
%Docstring
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)
%End

%TypeHeaderCode
Expand Down Expand Up @@ -66,22 +69,22 @@ Layer behavior flags.
.. versionadded:: 3.0
%End

bool canRunUsingLayer( QgsMapLayer *layer ) const;
virtual bool canRunUsingLayer( QgsMapLayer *layer ) const;
%Docstring
True if action can run using the specified layer
%End

void triggerForFeatures( QgsMapLayer *layer, const QList<QgsFeature> &featureList );
virtual void triggerForFeatures( QgsMapLayer *layer, const QList<QgsFeature> &featureList );
%Docstring
Triggers the action with the specified layer and list of feature.
%End

void triggerForFeature( QgsMapLayer *layer, const QgsFeature &feature );
virtual void triggerForFeature( QgsMapLayer *layer, const QgsFeature &feature );
%Docstring
Triggers the action with the specified layer and feature.
%End

void triggerForLayer( QgsMapLayer *layer );
virtual void triggerForLayer( QgsMapLayer *layer );
%Docstring
Triggers the action with the specified layer.
%End
Expand Down
11 changes: 7 additions & 4 deletions src/gui/qgsmaplayeractionregistry.h
Expand Up @@ -30,6 +30,9 @@ class QgsFeature;
/**
* \ingroup gui
* \brief 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)
*/
class GUI_EXPORT QgsMapLayerAction : public QAction
{
Expand Down Expand Up @@ -83,16 +86,16 @@ class GUI_EXPORT QgsMapLayerAction : public QAction
QgsMapLayerAction::Flags flags() const;

//! True if action can run using the specified layer
bool canRunUsingLayer( QgsMapLayer *layer ) const;
virtual bool canRunUsingLayer( QgsMapLayer *layer ) const;

//! Triggers the action with the specified layer and list of feature.
void triggerForFeatures( QgsMapLayer *layer, const QList<QgsFeature> &featureList );
virtual void triggerForFeatures( QgsMapLayer *layer, const QList<QgsFeature> &featureList );

//! Triggers the action with the specified layer and feature.
void triggerForFeature( QgsMapLayer *layer, const QgsFeature &feature );
virtual void triggerForFeature( QgsMapLayer *layer, const QgsFeature &feature );

//! Triggers the action with the specified layer.
void triggerForLayer( QgsMapLayer *layer );
virtual void triggerForLayer( QgsMapLayer *layer );

//! Define the targets of the action
void setTargets( Targets targets ) {mTargets = targets;}
Expand Down

0 comments on commit 523510c

Please sign in to comment.