QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Contains utilities for working with QgsExpressionContext objects, including methods for creating scopes for specific uses (eg project scopes, layer scopes). More...
#include <qgsexpressioncontext.h>
Static Public Member Functions | |
static QgsExpressionContextScope * | atlasScope (const QgsAtlasComposition *atlas) |
Creates a new scope which contains variables and functions relating to a QgsAtlasComposition. More... | |
static QgsExpressionContextScope * | composerItemScope (const QgsComposerItem *composerItem) |
Creates a new scope which contains variables and functions relating to a QgsComposerItem. More... | |
static QgsExpressionContextScope * | compositionScope (const QgsComposition *composition) |
Creates a new scope which contains variables and functions relating to a QgsComposition. 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 * | 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 * | mapSettingsScope (const QgsMapSettings &mapSettings) |
Creates a new scope which contains variables and functions relating to a QgsMapSettings object. More... | |
static QgsExpressionContextScope * | projectScope () |
Creates a new scope which contains variables and functions relating to the current QGIS project. More... | |
static void | registerContextFunctions () |
Registers all known core functions provided by QgsExpressionContextScope objects. More... | |
static void | setComposerItemVariable (QgsComposerItem *composerItem, const QString &name, const QVariant &value) |
Sets a composer item context variable. More... | |
static void | setComposerItemVariables (QgsComposerItem *composerItem, const QgsStringMap &variables) |
Sets all composition context variables. More... | |
static void | setCompositionVariable (QgsComposition *composition, const QString &name, const QVariant &value) |
Sets a composition context variable. More... | |
static void | setCompositionVariables (QgsComposition *composition, const QgsStringMap &variables) |
Sets all composition context variables. More... | |
static void | setGlobalVariable (const QString &name, const QVariant &value) |
Sets a global context variable. More... | |
static void | setGlobalVariables (const QgsStringMap &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 QgsStringMap &variables) |
Sets all layer context variables. More... | |
static void | setProjectVariable (const QString &name, const QVariant &value) |
Sets a project context variable. More... | |
static void | setProjectVariables (const QgsStringMap &variables) |
Sets all project context variables. More... | |
static QgsExpressionContextScope * | updateSymbolScope (const QgsSymbolV2 *symbol, QgsExpressionContextScope *symbolScope=nullptr) |
Updates a symbol scope related to a QgsSymbolV2 to an expression context. More... | |
Contains utilities for working with QgsExpressionContext objects, including methods for creating scopes for specific uses (eg project scopes, layer scopes).
Definition at line 520 of file qgsexpressioncontext.h.
|
static |
Creates a new scope which contains variables and functions relating to a QgsAtlasComposition.
For instance, current page name and number.
atlas | source atlas. If null, a set of default atlas variables will be added to the scope. |
Definition at line 856 of file qgsexpressioncontext.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a QgsComposerItem.
For instance, item size and position.
composerItem | source composer item |
Definition at line 893 of file qgsexpressioncontext.cpp.
|
static |
Creates a new scope which contains variables and functions relating to a QgsComposition.
For instance, number of pages and page sizes.
composition | source composition |
Definition at line 789 of file qgsexpressioncontext.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 959 of file qgsexpressioncontext.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 482 of file qgsexpressioncontext.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 676 of file qgsexpressioncontext.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 751 of file qgsexpressioncontext.cpp.
|
static |
Creates a new scope which contains variables and functions relating to the current QGIS project.
For instance, project path and title, and variables specified through the project properties.
Definition at line 609 of file qgsexpressioncontext.cpp.
|
static |
Registers all known core functions provided by QgsExpressionContextScope objects.
Definition at line 967 of file qgsexpressioncontext.cpp.
|
static |
Sets a composer item context variable.
This variable will be contained within scopes retrieved via composerItemScope().
composerItem | target composer item |
name | variable name |
value | variable value |
Definition at line 924 of file qgsexpressioncontext.cpp.
|
static |
Sets all composition context variables.
Existing compositoin variables will be removed and replaced with the variables specified.
composerItem | target composer item |
variables | new set of layer variables |
Definition at line 940 of file qgsexpressioncontext.cpp.
|
static |
Sets a composition context variable.
This variable will be contained within scopes retrieved via compositionScope().
composition | target composition |
name | variable name |
value | variable value |
Definition at line 821 of file qgsexpressioncontext.cpp.
|
static |
Sets all composition context variables.
Existing composition variables will be removed and replaced with the variables specified.
composition | target composition |
variables | new set of layer variables |
Definition at line 837 of file qgsexpressioncontext.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 523 of file qgsexpressioncontext.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 538 of file qgsexpressioncontext.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 716 of file qgsexpressioncontext.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 732 of file qgsexpressioncontext.cpp.
|
static |
Sets a project context variable.
This variable will be contained within scopes retrieved via projectScope().
name | variable name |
value | variable value |
Definition at line 642 of file qgsexpressioncontext.cpp.
|
static |
Sets all project context variables.
Existing project variables will be removed and replaced with the variables specified.
variables | new set of project variables |
Definition at line 657 of file qgsexpressioncontext.cpp.
|
static |
Updates a symbol scope related to a QgsSymbolV2 to an expression context.
symbol | symbol to extract properties from |
symbolScope | pointer to an existing scope to update |
Definition at line 771 of file qgsexpressioncontext.cpp.