QGIS API Documentation
2.14.0-Essen
|
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 456 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 816 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 853 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 749 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 919 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 445 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 639 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 714 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 572 of file qgsexpressioncontext.cpp.
|
static |
Registers all known core functions provided by QgsExpressionContextScope objects.
Definition at line 927 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 884 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 900 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 781 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 797 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 486 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 501 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 679 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 695 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 605 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 620 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 731 of file qgsexpressioncontext.cpp.