QgsActionScope class
An action scope defines a "place" for an action to be shown and may add additional expression variables.
Contents
Each QgsAction can be available in one or several action scopes.
Examples:
- Canvas
- Show for canvas tools. Adds
@clicked_xand@clicked_yin map coordinates. - Feature
- Show in feature specific places like the attribute table or feature form.
- Field
- Show in context menus for individual fields (e.g. attribute table). Adds
@field_index,@field_nameand@field_value. - Layer
- Show in attribute table and work on the layer or selection.
Constructors, destructors, conversion operators
- QgsActionScope() explicit
- Creates a new invalid action scope.
- QgsActionScope(const QString& id, const QString& title, const QString& description, const QgsExpressionContextScope& expressionContextScope = QgsExpressionContextScope()) explicit
- Creates a new action scope.
Public functions
- auto description() const -> QString
- The description should be a longer description of where actions in this scope are available.
- auto expressionContextScope() const -> QgsExpressionContextScope
- An expression scope may offer additional variables for an action scope.
- auto id() const -> QString
- A unique identifier for this action scope.
- auto isValid() const -> bool
- Returns if this scope is valid.
- auto operator==(const QgsActionScope& other) const -> bool
- Compares two action scopes.
- void setDescription(const QString& description)
- The description should be a longer description of where actions in this scope are available.
- void setExpressionContextScope(const QgsExpressionContextScope& expressionContextScope)
- An expression scope may offer additional variables for an action scope.
- void setId(const QString& id)
- A unique identifier for this action scope.
- void setTitle(const QString& title)
- The title is a human readable and translated string that will be presented to the user in the properties dialog.
- auto title() const -> QString
- The title is a human readable and translated string that will be presented to the user in the properties dialog.
Function documentation
QgsActionScope:: QgsActionScope() explicit
Creates a new invalid action scope.
QgsActionScope:: QgsActionScope(const QString& id,
const QString& title,
const QString& description,
const QgsExpressionContextScope& expressionContextScope = QgsExpressionContextScope()) explicit
Creates a new action scope.
For details concerning the parameters check the documentation of the corresponding properties.
QString QgsActionScope:: description() const
The description should be a longer description of where actions in this scope are available.
It is not necessary to list the available expression variables in here, they are extracted automatically from the expressionContextScope().
QgsExpressionContextScope QgsActionScope:: expressionContextScope() const
An expression scope may offer additional variables for an action scope.
This can be an field_name for the attribute which was clicked or clicked_x and clicked_y for actions which are available as map canvas clicks.
QString QgsActionScope:: id() const
A unique identifier for this action scope.
bool QgsActionScope:: isValid() const
Returns if this scope is valid.
void QgsActionScope:: setDescription(const QString& description)
The description should be a longer description of where actions in this scope are available.
It is not necessary to list the available expression variables in here, they are extracted automatically from the expressionContextScope().
void QgsActionScope:: setExpressionContextScope(const QgsExpressionContextScope& expressionContextScope)
An expression scope may offer additional variables for an action scope.
This can be an field_name for the attribute which was clicked or clicked_x and clicked_y for actions which are available as map canvas clicks.
void QgsActionScope:: setId(const QString& id)
A unique identifier for this action scope.
void QgsActionScope:: setTitle(const QString& title)
The title is a human readable and translated string that will be presented to the user in the properties dialog.
QString QgsActionScope:: title() const
The title is a human readable and translated string that will be presented to the user in the properties dialog.