24 , mFeatureId( feature->id() )
25 , mOwnsFeature( false )
36 , mOwnsFeature( false )
41 void QgsActionMenu::init()
52 if ( !mFeature || !mFeature->
isValid() )
85 void QgsActionMenu::triggerAction()
113 void QgsActionMenu::reloadActions()
120 for (
int idx = 0; idx < mActions->
size(); ++idx )
124 QAction* action =
new QAction( qaction.icon(), qaction.name(), this );
125 action->
setData( QVariant::fromValue<ActionData>(
ActionData( idx, mFeatureId, mLayer ) ) );
126 action->setIcon( qaction.icon() );
129 if ( !qaction.runable() )
131 action->setEnabled(
false );
132 action->setToolTip(
tr(
"Not supported on your platform" ) );
136 action->setToolTip( qaction.action() );
144 if ( !mapLayerActions.
isEmpty() )
149 for (
int i = 0; i < mapLayerActions.
size(); ++i )
153 action->
setData( QVariant::fromValue<ActionData>(
ActionData( qaction, mFeatureId, mLayer ) ) );
164 mExpressionContextScope = scope;
169 return mExpressionContextScope;
bool isValid() const
Returns the validity of this feature.
bool canConvert(Type t) const
QgsActionManager * actions()
Get all layer actions defined on this layer.
QgsVectorLayer * layer() const
Return the layer.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &request=QgsFeatureRequest())
Query the provider for features specified in request.
const T & at(int i) const
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QString tr(const char *sourceText, const char *disambiguation, int n)
const QgsAction & at(int idx) const
Get the action at the specified index.
Utility class that encapsulates an action based on vector attributes.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
Storage and management of actions associated with a layer.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void setData(const QVariant &userData)
static QgsMapLayerActionRegistry * instance()
Returns the instance pointer, creating the object on the first call.
QList< QgsMapLayerAction * > mapLayerActions(QgsMapLayer *layer, const QgsMapLayerAction::Targets &targets=QgsMapLayerAction::AllActions)
Returns the map layer actions which can run on the specified layer.
bool nextFeature(QgsFeature &f)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
int size() const
Get the number of actions managed by this.
void doAction(int index, const QgsFeature &feat, int defaultValueIndex=0, const QgsExpressionContextScope &scope=QgsExpressionContextScope())
Does the given action.
void triggerForFeature(QgsMapLayer *layer, const QgsFeature *feature)
Triggers the action with the specified layer and feature.
An action which can run on map layers.