Skip to content

Class ExpressionEvaluator

ClassList > ExpressionEvaluator

The ExpressionEvaluator class enables evaluation of expression strings and expression templates.

  • #include <expressionevaluator.h>

Inherits the following classes: QObject

Public Types

Type Name
enum Mode
Expression evaluator modes.

Public Properties

Type Name
property AppExpressionContextScopesGenerator * appExpressionContextScopesGenerator
property QString expressionText
property QgsFeature feature
property QgsMapLayer * layer
property QgsQuickMapSettings * mapSettings
property Mode mode
property QgsProject * project
property QVariantMap variables

Public Signals

Type Name
signal void appExpressionContextScopesGeneratorChanged
signal void expressionTextChanged
signal void featureChanged
signal void layerChanged
signal void mapSettingsChanged
signal void modeChanged
signal void projectChanged
signal void variablesChanged

Public Functions

Type Name
ExpressionEvaluator (QObject * parent=nullptr)
AppExpressionContextScopesGenerator * appExpressionContextScopesGenerator () const
Returns the application expression context scopes generator object.
Q_INVOKABLE QVariant evaluate ()
Returns the evaluated expression text value.
QString expressionText ()
Returns the expression text used when evaluating.
QgsFeature feature () const
Returns the feature attached to the expression context.
QgsMapLayer * layer () const
Returns the map layer attached to the expression context.
QgsQuickMapSettings * mapSettings () const
Returns the map settings attached to the expression context.
Mode mode () const
Returns the expression evaluator mode.
QgsProject * project () const
Returns the project attached to the expression context.
void setAppExpressionContextScopesGenerator (AppExpressionContextScopesGenerator * generator)
Sets the application expression context scopes generator object.
void setExpressionText (const QString & expressionText)
Sets the expression text used when evaluating.
void setFeature (const QgsFeature & feature)
Sets the feature attached to the expression context.
void setLayer (QgsMapLayer * layer)
Sets the map layer attached to the expression context.
void setMapSettings (QgsQuickMapSettings * mapSettings)
Sets the map settings attached to the expression context.
void setMode (Mode mode)
Sets the expression evaluator mode .
void setProject (QgsProject * project)
Sets the project attached to the expression context.
void setVariables (const QVariantMap & variables)
Sets the map of variables injected into the expression context when evaluating.
QVariantMap variables () const
Returns the map of variables injected into the expression context when evaluating.

Public Types Documentation

enum Mode

Expression evaluator modes.

enum ExpressionEvaluator::Mode {
    ExpressionMode,
    ExpressionTemplateMode
};

Public Properties Documentation

property appExpressionContextScopesGenerator [1/2]

AppExpressionContextScopesGenerator * ExpressionEvaluator::appExpressionContextScopesGenerator;

property expressionText [1/2]

QString ExpressionEvaluator::expressionText;

property feature [1/2]

QgsFeature ExpressionEvaluator::feature;

property layer [1/2]

QgsMapLayer * ExpressionEvaluator::layer;

property mapSettings [1/2]

QgsQuickMapSettings * ExpressionEvaluator::mapSettings;

property mode [1/2]

Mode ExpressionEvaluator::mode;

property project [1/2]

QgsProject * ExpressionEvaluator::project;

property variables [1/2]

QVariantMap ExpressionEvaluator::variables;

Public Signals Documentation

signal appExpressionContextScopesGeneratorChanged

void ExpressionEvaluator::appExpressionContextScopesGeneratorChanged;

signal expressionTextChanged

void ExpressionEvaluator::expressionTextChanged;

signal featureChanged

void ExpressionEvaluator::featureChanged;

signal layerChanged

void ExpressionEvaluator::layerChanged;

signal mapSettingsChanged

void ExpressionEvaluator::mapSettingsChanged;

signal modeChanged

void ExpressionEvaluator::modeChanged;

signal projectChanged

void ExpressionEvaluator::projectChanged;

signal variablesChanged

void ExpressionEvaluator::variablesChanged;

Public Functions Documentation

function ExpressionEvaluator

explicit ExpressionEvaluator::ExpressionEvaluator (
    QObject * parent=nullptr
) 

function appExpressionContextScopesGenerator [2/2]

Returns the application expression context scopes generator object.

AppExpressionContextScopesGenerator * ExpressionEvaluator::appExpressionContextScopesGenerator () const

function evaluate

Returns the evaluated expression text value.

Q_INVOKABLE QVariant ExpressionEvaluator::evaluate () 

function expressionText [2/2]

Returns the expression text used when evaluating.

inline QString ExpressionEvaluator::expressionText () 

function feature [2/2]

Returns the feature attached to the expression context.

inline QgsFeature ExpressionEvaluator::feature () const

function layer [2/2]

Returns the map layer attached to the expression context.

inline QgsMapLayer * ExpressionEvaluator::layer () const

function mapSettings [2/2]

Returns the map settings attached to the expression context.

inline QgsQuickMapSettings * ExpressionEvaluator::mapSettings () const

function mode [2/2]

Returns the expression evaluator mode.

inline Mode ExpressionEvaluator::mode () const

function project [2/2]

Returns the project attached to the expression context.

inline QgsProject * ExpressionEvaluator::project () const

function setAppExpressionContextScopesGenerator

Sets the application expression context scopes generator object.

void ExpressionEvaluator::setAppExpressionContextScopesGenerator (
    AppExpressionContextScopesGenerator * generator
) 

function setExpressionText

Sets the expression text used when evaluating.

void ExpressionEvaluator::setExpressionText (
    const QString & expressionText
) 

function setFeature

Sets the feature attached to the expression context.

void ExpressionEvaluator::setFeature (
    const QgsFeature & feature
) 

function setLayer

Sets the map layer attached to the expression context.

void ExpressionEvaluator::setLayer (
    QgsMapLayer * layer
) 

function setMapSettings

Sets the map settings attached to the expression context.

void ExpressionEvaluator::setMapSettings (
    QgsQuickMapSettings * mapSettings
) 

function setMode

Sets the expression evaluator mode .

void ExpressionEvaluator::setMode (
    Mode mode
) 

function setProject

Sets the project attached to the expression context.

void ExpressionEvaluator::setProject (
    QgsProject * project
) 

function setVariables

Sets the map of variables injected into the expression context when evaluating.

void ExpressionEvaluator::setVariables (
    const QVariantMap & variables
) 

function variables [2/2]

Returns the map of variables injected into the expression context when evaluating.

inline QVariantMap ExpressionEvaluator::variables () const


The documentation for this class was generated from the following file src/core/expressionevaluator.h