20#include "moc_qgsmaplayeractionregistry.cpp"
34 QList<QgsMapLayerAction *> validActions;
40 canRun = action->canRunUsingLayer( layer );
43 canRun = action->canRunUsingLayer( layer, context );
45 if ( canRun && ( targets & action->targets() ) )
47 validActions.append( action );
61 QMap<QgsMapLayer *, QgsMapLayerAction *>::iterator defaultIt;
62 for ( defaultIt = mDefaultLayerActionMap.begin(); defaultIt != mDefaultLayerActionMap.end(); ++defaultIt )
64 if ( defaultIt.value() == action )
66 defaultIt.value() =
nullptr;
78 mDefaultLayerActionMap[layer] = action;
83 if ( !mDefaultLayerActionMap.contains( layer ) )
88 return mDefaultLayerActionMap[layer];
QFlags< MapLayerActionTarget > MapLayerActionTargets
Map layer action targets.
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.
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.
QList< QgsMapLayerAction * > mMapLayerActionList
An action which can run on map layers.
Base class for all map layer types.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH