17#include "moc_qgsmaplayeractionregistry.cpp"
33 QList<QgsMapLayerAction *> validActions;
39 canRun = action->canRunUsingLayer( layer );
42 canRun = action->canRunUsingLayer( layer, context );
44 if ( canRun && ( targets & action->targets() ) )
46 validActions.append( action );
60 QMap<QgsMapLayer *, QgsMapLayerAction *>::iterator defaultIt;
61 for ( defaultIt = mDefaultLayerActionMap.begin(); defaultIt != mDefaultLayerActionMap.end(); ++defaultIt )
63 if ( defaultIt.value() == action )
65 defaultIt.value() =
nullptr;
77 mDefaultLayerActionMap[layer] = action;
82 if ( !mDefaultLayerActionMap.contains( layer ) )
87 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 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