Class: QgsActionScope¶
An action scope defines a “place” for an action to be shown and may add additional expression variables.
Each QgsAction
can be available in one or several action
scopes.
Examples¶
Canvas¶
Show for canvas tools. Adds @click_x and @click_y in 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_name and @field_value.
Layer¶
Show in attribute table and work on the layer or selection.
Methods
Returns the action scope's description. |
|
Returns the expression context scope for the action scope. |
|
Returns the unique identifier for this action scope. |
|
Returns |
|
Sets the action scope's description. |
|
Sets the expression context scope for the action scope. |
|
Sets the unique id for this action scope. |
|
Sets the action scope's title. |
|
Returns the action scope's title. |
- class qgis.core.QgsActionScope[source]¶
Bases:
object
- __init__()
Creates a new invalid action scope.
- __init__(id: str | None, title: str | None, description: str | None, expressionContextScope: QgsExpressionContextScope = QgsExpressionContextScope())
Creates a new action scope. For details concerning the parameters check the documentation of the corresponding properties.
- Parameters:
id (Optional[str])
title (Optional[str])
description (Optional[str])
expressionContextScope (
QgsExpressionContextScope
= QgsExpressionContextScope())
- __init__(a0: QgsActionScope)
- Parameters:
a0 (QgsActionScope)
- description(self) str [source]¶
Returns the action scope’s 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()
.See also
- Return type:
str
- expressionContextScope(self) QgsExpressionContextScope [source]¶
Returns the expression context scope for the action scope.
An expression scope may offer additional variables for an action scope. This can be an field_name for the attribute which was clicked or click_x and click_y for actions which are available as map canvas clicks.
See also
- Return type:
- id(self) str [source]¶
Returns the unique identifier for this action scope.
See also
- Return type:
str
- setDescription(self, description: str | None)[source]¶
Sets the action scope’s
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()
.See also
- Parameters:
description (Optional[str])
- setExpressionContextScope(self, expressionContextScope: QgsExpressionContextScope)[source]¶
Sets the expression context scope for the action scope.
An expression scope may offer additional variables for an action scope. This can be an field_name for the attribute which was clicked or click_x and click_y for actions which are available as map canvas clicks.
See also
- Parameters:
expressionContextScope (QgsExpressionContextScope)
- setId(self, id: str | None)[source]¶
Sets the unique
id
for this action scope.See also
- Parameters:
id (Optional[str])
- setTitle(self, title: str | None)[source]¶
Sets the action scope’s
title
.The title should be a human readable and translated string that will be presented to the user in the properties dialog.
See also
- Parameters:
title (Optional[str])