QgsActionMenu class

This class is a menu that is populated automatically with the actions defined for a given layer.

Public types

enum ActionType { Invalid, MapLayerAction, AttributeAction }

Constructors, destructors, conversion operators

QgsActionMenu(QgsVectorLayer* layer, const QgsFeature& feature, const QString& actionScope, QWidget* parent = nullptr) explicit
Constructs a new QgsActionMenu.
QgsActionMenu(QgsVectorLayer* layer, QgsFeatureId fid, const QString& actionScope, QWidget* parent = nullptr) explicit
Constructs a new QgsActionMenu.

Public functions

auto expressionContextScope() const -> QgsExpressionContextScope
Returns an expression context scope used to resolve underlying actions.
void setExpressionContextScope(const QgsExpressionContextScope& scope)
Sets an expression context scope used to resolve underlying actions.
void setFeature(const QgsFeature& feature)
Change the feature on which actions are performed.
void setMode(QgsAttributeEditorContext::Mode mode)
Change the mode of the actions.

Enum documentation

enum QgsActionMenu::ActionType

Enumerators
Invalid

Invalid.

MapLayerAction

Standard actions (defined by core or plugins)

AttributeAction

Custom actions (manually defined in layer properties)

Function documentation

QgsActionMenu::QgsActionMenu(QgsVectorLayer* layer, const QgsFeature& feature, const QString& actionScope, QWidget* parent = nullptr) explicit

Constructs a new QgsActionMenu.

Parameters
layer The layer that this action will be run upon.
feature The feature that this action will be run upon. Make sure that this feature is available for the lifetime of this object.
actionScope The action scope this menu will run in
parent The usual QWidget parent.

QgsActionMenu::QgsActionMenu(QgsVectorLayer* layer, QgsFeatureId fid, const QString& actionScope, QWidget* parent = nullptr) explicit

Constructs a new QgsActionMenu.

Parameters
layer The layer that this action will be run upon.
fid The feature id of the feature for which this action will be run.
actionScope The action scope this menu will run in
parent The usual QWidget parent.

QgsExpressionContextScope QgsActionMenu::expressionContextScope() const

Returns an expression context scope used to resolve underlying actions.

void QgsActionMenu::setExpressionContextScope(const QgsExpressionContextScope& scope)

Sets an expression context scope used to resolve underlying actions.

void QgsActionMenu::setFeature(const QgsFeature& feature)

Change the feature on which actions are performed.

Parameters
feature A feature. Will not take ownership. It's the callers responsibility to keep the feature as long as the menu is displayed and the action is running.

void QgsActionMenu::setMode(QgsAttributeEditorContext::Mode mode)

Change the mode of the actions.

Parameters
mode The mode of the attribute form