Subgroup: Action

Class: QgsActionScope

class qgis.core.QgsActionScope

Bases: sip.wrapper

Creates a new invalid action scope.

New in version 3.0.

QgsActionScope(id: str, title: str, description: str, expressionContextScope: QgsExpressionContextScope = QgsExpressionContextScope()) Creates a new action scope. For details concerning the parameters check the documentation of the corresponding properties.

QgsActionScope(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.

<dl> <dt>Canvas</dt> <dd>Show for canvas tools. Adds @clicked_x and @clicked_y in map coordinates.</dd> <dt>Feature</dt> <dd>Show in feature specific places like the attribute table or feature form.</dd> <dt>Field</dt> <dd>Show in context menus for individual fields (e.g. attribute table). Adds @field_index, @field_name and @field_value.</dd> <dt>Layer</dt> <dd>Show in attribute table and work on the layer or selection.</dd> </dl>

New in version 3.0: Methods

description The description should be a longer description of where actions in this scope are available.
expressionContextScope An expression scope may offer additional variables for an action scope.
id A unique identifier for this action scope.
isValid Returns if this scope is valid.
setDescription copydoc description()
setExpressionContextScope copydoc expressionContextScope()
setId copydoc id()
setTitle copydoc title()
title The title is a human readable and translated string that will be presented to the user in the properties dialog.

Signals

Attributes

description(self) → str

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().

New in version 3.0.

expressionContextScope(self) → QgsExpressionContextScope

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.

New in version 3.0.

id(self) → str

A unique identifier for this action scope.

New in version 3.0.

isValid(self) → bool

Returns if this scope is valid.

New in version 3.0.

setDescription(self, description: str)

copydoc description()

setExpressionContextScope(self, expressionContextScope: QgsExpressionContextScope)

copydoc expressionContextScope()

setId(self, id: str)

copydoc id()

setTitle(self, title: str)

copydoc title()

title(self) → str

The title is a human readable and translated string that will be presented to the user in the properties dialog.

New in version 3.0.