QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
|
Contains utilities for working with QgsExpressionContext objects, including methods for creating scopes for specific uses (e.g., project scopes, layer scopes). More...
#include <qgsexpressioncontextutils.h>
Static Public Member Functions | |
static QgsExpressionContextScope * | atlasScope (const QgsLayoutAtlas *atlas) |
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas. More... | |
static QgsExpressionContext | createFeatureBasedContext (const QgsFeature &feature, const QgsFields &fields) |
Helper function for creating an expression context which contains just a feature and fields collection. More... | |
static QgsExpressionContextScope * | formScope (const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString()) |
Creates a new scope which contains functions and variables from the current attribute form/table formFeature. More... | |
static QList< QgsExpressionContextScope * > | globalProjectLayerScopes (const QgsMapLayer *layer) |
Creates a list of three scopes: global, layer's project and layer. More... | |
static QgsExpressionContextScope * | globalScope () |
Creates a new scope which contains variables and functions relating to the global QGIS context. More... | |
static QgsExpressionContextScope * | layerScope (const QgsMapLayer *layer) |
Creates a new scope which contains variables and functions relating to a QgsMapLayer. More... | |
static QgsExpressionContextScope * | layoutItemScope (const QgsLayoutItem *item) |
Creates a new scope which contains variables and functions relating to a QgsLayoutItem. More... | |
static QgsExpressionContextScope * | layoutScope (const QgsLayout *layout) |
Creates a new scope which contains variables and functions relating to a QgsLayout layout. More... | |
static QgsExpressionContextScope * | mapLayerPositionScope (const QgsPointXY &position) |
Sets the expression context variables which are available for expressions triggered by moving the mouse over a feature of the currently selected layer. More... | |
static QgsExpressionContextScope * | mapSettingsScope (const QgsMapSettings &mapSettings) |
Creates a new scope which contains variables and functions relating to a QgsMapSettings object. More... | |
static QgsExpressionContextScope * | mapToolCaptureScope (const QList< QgsPointLocator::Match > &matches) |
Sets the expression context variables which are available for expressions triggered by a map tool capture like add feature. More... | |
static QgsExpressionContextScope * | meshExpressionScope (QgsMesh::ElementType elementType) |
Creates a new scope which contains functions relating to mesh layer element elementType. More... | |
static QgsExpressionContextScope * | multiFrameScope (const QgsLayoutMultiFrame *frame) |
Creates a new scope which contains variables and functions relating to a QgsLayoutMultiFrame. More... | |
static QgsExpressionContextScope * | notificationScope (const QString &message=QString()) |
Creates a new scope which contains variables and functions relating to provider notifications. More... | |
static QgsExpressionContextScope * | parentFormScope (const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString()) |
Creates a new scope which contains functions and variables from the current parent attribute form/table formFeature. More... | |
static QgsExpressionContextScope * | processingAlgorithmScope (const QgsProcessingAlgorithm *algorithm, const QVariantMap ¶meters, QgsProcessingContext &context) |
Creates a new scope which contains variables and functions relating to a processing algorithm, when used with the specified parameters and context. More... | |
static QgsExpressionContextScope * | processingModelAlgorithmScope (const QgsProcessingModelAlgorithm *model, const QVariantMap ¶meters, QgsProcessingContext &context) |
Creates a new scope which contains variables and functions relating to a processing model algorithm, when used with the specified parameters and context. More... | |
static QgsExpressionContextScope * | projectScope (const QgsProject *project) |
Creates a new scope which contains variables and functions relating to a QGIS project. More... | |
static void | registerContextFunctions () |
Registers all known core functions provided by QgsExpressionContextScope objects. More... | |
static void | removeGlobalVariable (const QString &name) |
Remove a global context variable. More... | |
static void | removeProjectVariable (QgsProject *project, const QString &name) |
Remove project context variable. More... | |
static void | setGlobalVariable (const QString &name, const QVariant &value) |
Sets a global context variable. More... | |
static void | setGlobalVariables (const QVariantMap &variables) |
Sets all global context variables. More... | |
static void | setLayerVariable (QgsMapLayer *layer, const QString &name, const QVariant &value) |
Sets a layer context variable. More... | |
static void | setLayerVariables (QgsMapLayer *layer, const QVariantMap &variables) |
Sets all layer context variables. More... | |
static void | setLayoutItemVariable (QgsLayoutItem *item, const QString &name, const QVariant &value) |
Sets a layout item context variable, with the given name and value. More... | |
static void | setLayoutItemVariables (QgsLayoutItem *item, const QVariantMap &variables) |
Sets all layout item context variables for an item. More... | |
static void | setLayoutMultiFrameVariable (QgsLayoutMultiFrame *frame, const QString &name, const QVariant &value) |
Sets a layout multi frame context variable, with the given name and value. More... | |
static void | setLayoutMultiFrameVariables (QgsLayoutMultiFrame *frame, const QVariantMap &variables) |
Sets all layout multiframe context variables for an frame. More... | |
static void | setLayoutVariable (QgsLayout *layout, const QString &name, const QVariant &value) |
Sets a layout context variable. More... | |
static void | setLayoutVariables (QgsLayout *layout, const QVariantMap &variables) |
Sets all layout context variables. More... | |
static void | setProjectVariable (QgsProject *project, const QString &name, const QVariant &value) |
Sets a project context variable. More... | |
static void | setProjectVariables (QgsProject *project, const QVariantMap &variables) |
Sets all project context variables. More... | |
static QgsExpressionContextScope * | updateSymbolScope (const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr) |
Updates a symbol scope related to a QgsSymbol to an expression context. More... | |
Friends | |
class | QgsLayoutItemMap |
Contains utilities for working with QgsExpressionContext objects, including methods for creating scopes for specific uses (e.g., project scopes, layer scopes).
Definition at line 48 of file qgsexpressioncontextutils.h.
|
static |
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
For instance, current page name and number.
atlas | source atlas. If nullptr , a set of default atlas variables will be added to the scope. |
Definition at line 691 of file qgsexpressioncontextutils.cpp.
|
static |
Helper function for creating an expression context which contains just a feature and fields collection.
Generally this method should not be used as the created context does not include standard scopes such as the global and project scopes.
Definition at line 873 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains functions and variables from the current attribute form/table formFeature.
The variables and values in this scope will reflect the current state of the form/row being edited. The formMode (SingleEditMode etc.) is passed as text
Definition at line 294 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a list of three scopes: global, layer's project and layer.
Definition at line 401 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to the global QGIS context.
For instance, QGIS version numbers and variables specified through QGIS options.
Definition at line 45 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
For instance, layer name, id and fields.
Definition at line 358 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a QgsLayoutItem.
For instance, item size and position.
Definition at line 730 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a QgsLayout layout.
For instance, number of pages and page sizes.
Definition at line 587 of file qgsexpressioncontextutils.cpp.
|
static |
Sets the expression context variables which are available for expressions triggered by moving the mouse over a feature of the currently selected layer.
position | map coordinates of the current pointer position in the CRS of the layer which triggered the action. |
Definition at line 562 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
For instance, map scale and rotation.
Definition at line 451 of file qgsexpressioncontextutils.cpp.
|
static |
Sets the expression context variables which are available for expressions triggered by a map tool capture like add feature.
Definition at line 538 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains functions relating to mesh layer element elementType.
|
static |
Creates a new scope which contains variables and functions relating to a QgsLayoutMultiFrame.
Definition at line 812 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to provider notifications.
message | the notification message |
Definition at line 929 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains functions and variables from the current parent attribute form/table formFeature.
The variables and values in this scope will reflect the current state of the parent form/row being edited. The formMode (SingleEditMode etc.) is passed as text
Definition at line 305 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a processing algorithm, when used with the specified parameters and context.
For instance, algorithm name and parameter functions.
Definition at line 881 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a processing model algorithm, when used with the specified parameters and context.
For instance, model name and path variables.
Definition at line 898 of file qgsexpressioncontextutils.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a QGIS project.
For instance, project path and title, and variables specified through the project properties.
project | What project to use |
Definition at line 315 of file qgsexpressioncontextutils.cpp.
|
static |
Registers all known core functions provided by QgsExpressionContextScope objects.
Definition at line 936 of file qgsexpressioncontextutils.cpp.
|
static |
Remove a global context variable.
name | variable name |
Definition at line 80 of file qgsexpressioncontextutils.cpp.
|
static |
Remove project context variable.
project | Project to apply changes to |
name | variable name |
Definition at line 346 of file qgsexpressioncontextutils.cpp.
|
static |
Sets a global context variable.
This variable will be contained within scopes retrieved via globalScope().
name | variable name |
value | variable value |
Definition at line 70 of file qgsexpressioncontextutils.cpp.
|
static |
Sets all global context variables.
Existing global variables will be removed and replaced with the variables specified.
variables | new set of global variables |
Definition at line 75 of file qgsexpressioncontextutils.cpp.
|
static |
Sets a layer context variable.
This variable will be contained within scopes retrieved via layerScope().
layer | map layer |
name | variable name |
value | variable value |
Definition at line 416 of file qgsexpressioncontextutils.cpp.
|
static |
Sets all layer context variables.
Existing layer variables will be removed and replaced with the variables specified.
layer | map layer |
variables | new set of layer variables |
Definition at line 432 of file qgsexpressioncontextutils.cpp.
|
static |
Sets a layout item context variable, with the given name and value.
This variable will be contained within scopes retrieved via layoutItemScope().
Definition at line 777 of file qgsexpressioncontextutils.cpp.
|
static |
Sets all layout item context variables for an item.
Existing variables will be removed and replaced with the variables specified.
Definition at line 793 of file qgsexpressioncontextutils.cpp.
|
static |
Sets a layout multi frame context variable, with the given name and value.
This variable will be contained within scopes retrieved via multiFrameScope().
Definition at line 838 of file qgsexpressioncontextutils.cpp.
|
static |
Sets all layout multiframe context variables for an frame.
Existing variables will be removed and replaced with the variables specified.
Definition at line 854 of file qgsexpressioncontextutils.cpp.
|
static |
Sets a layout context variable.
This variable will be contained within scopes retrieved via layoutScope().
layout | target layout |
name | variable name |
value | variable value |
Definition at line 656 of file qgsexpressioncontextutils.cpp.
|
static |
Sets all layout context variables.
Existing layout variables will be removed and replaced with the variables specified.
layout | target layout |
variables | new set of layer variables |
Definition at line 672 of file qgsexpressioncontextutils.cpp.
|
static |
Sets a project context variable.
This variable will be contained within scopes retrieved via projectScope().
project | Project to apply changes to |
name | variable name |
value | variable value |
Definition at line 326 of file qgsexpressioncontextutils.cpp.
|
static |
Sets all project context variables.
Existing project variables will be removed and replaced with the variables specified.
project | Project to apply changes to |
variables | new set of project variables |
Definition at line 338 of file qgsexpressioncontextutils.cpp.
|
static |
Updates a symbol scope related to a QgsSymbol to an expression context.
symbol | symbol to extract properties from |
symbolScope | pointer to an existing scope to update |
Definition at line 569 of file qgsexpressioncontextutils.cpp.
|
friend |
Definition at line 360 of file qgsexpressioncontextutils.h.