32 QList< QgsMapLayerAction * > validActions;
38 canRun = action->canRunUsingLayer( layer );
41 canRun = action->canRunUsingLayer( layer, context );
43 if ( canRun && ( targets & action->targets() ) )
45 validActions.append( action );
59 QMap<QgsMapLayer *, QgsMapLayerAction *>::iterator defaultIt;
60 for ( defaultIt = mDefaultLayerActionMap.begin(); defaultIt != mDefaultLayerActionMap.end(); ++defaultIt )
62 if ( defaultIt.value() == action )
64 defaultIt.value() =
nullptr;
76 mDefaultLayerActionMap[ layer ] = action;
81 if ( !mDefaultLayerActionMap.contains( layer ) )
86 return mDefaultLayerActionMap[ layer ];
Encapsulates the context in which a QgsMapLayerAction action is executed.
void addMapLayerAction(QgsMapLayerAction *action)
Adds a map layer action to the registry.
void changed()
Triggered when an action is added or removed from the registry.
bool removeMapLayerAction(QgsMapLayerAction *action)
Removes a map layer action from the registry.
QgsMapLayerActionRegistry(QObject *parent=nullptr)
Constructor for QgsMapLayerActionRegistry.
QList< QgsMapLayerAction * > mMapLayerActionList
void setDefaultActionForLayer(QgsMapLayer *layer, QgsMapLayerAction *action)
Sets the default action for a layer.
QgsMapLayerAction * defaultActionForLayer(QgsMapLayer *layer)
Returns the default action for a layer.
QList< QgsMapLayerAction * > mapLayerActions(QgsMapLayer *layer, Qgis::MapLayerActionTargets targets=Qgis::MapLayerActionTarget::AllActions, const QgsMapLayerActionContext &context=QgsMapLayerActionContext())
Returns the map layer actions which can run on the specified layer.
An action which can run on map layers The class can be used in two manners:
Base class for all map layer types.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH