Skip to content

Class QfExpressionEvaluator

ClassList > QfExpressionEvaluator

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

  • #include <qfexpressionevaluator.h>

Inherits the following classes: QObject

Public Types

Type Name
enum Mode
Expression evaluator modes.

Public Properties

Type Name
property QfAppExpressionContextScopesGenerator * appExpressionContextScopesGenerator
property QfAttributeFormModel * attributeFormModel
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 attributeFormModelChanged
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
QfExpressionEvaluator (QObject * parent=nullptr)
QfAppExpressionContextScopesGenerator * appExpressionContextScopesGenerator () const
Returns the application expression context scopes generator object.
QfAttributeFormModel * attributeFormModel () const
Returns the attribute form model providing an expression context.
Q_INVOKABLE QVariant evaluate ()
Evalutes and returns the current expression text property value.
Q_INVOKABLE QVariant evaluate (const QString & expressionText)
Evalutes and returns the expression text passed as a parameter.
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 (QfAppExpressionContextScopesGenerator * generator)
Sets the application expression context scopes generator object.
void setAttributeFormModel (QfAttributeFormModel * attributeFormModel)
Sets the attribute form model providing an expression context.
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 QfExpressionEvaluator::Mode {
    ExpressionMode,
    ExpressionTemplateMode
};


Public Properties Documentation

property appExpressionContextScopesGenerator [1/2]

QfAppExpressionContextScopesGenerator * QfExpressionEvaluator::appExpressionContextScopesGenerator;

property attributeFormModel [1/2]

QfAttributeFormModel * QfExpressionEvaluator::attributeFormModel;

property expressionText [1/2]

QString QfExpressionEvaluator::expressionText;

property feature [1/2]

QgsFeature QfExpressionEvaluator::feature;

property layer [1/2]

QgsMapLayer * QfExpressionEvaluator::layer;

property mapSettings [1/2]

QgsQuickMapSettings * QfExpressionEvaluator::mapSettings;

property mode [1/2]

Mode QfExpressionEvaluator::mode;

property project [1/2]

QgsProject * QfExpressionEvaluator::project;

property variables [1/2]

QVariantMap QfExpressionEvaluator::variables;

Public Signals Documentation

signal appExpressionContextScopesGeneratorChanged

void QfExpressionEvaluator::appExpressionContextScopesGeneratorChanged;

signal attributeFormModelChanged

void QfExpressionEvaluator::attributeFormModelChanged;

signal expressionTextChanged

void QfExpressionEvaluator::expressionTextChanged;

signal featureChanged

void QfExpressionEvaluator::featureChanged;

signal layerChanged

void QfExpressionEvaluator::layerChanged;

signal mapSettingsChanged

void QfExpressionEvaluator::mapSettingsChanged;

signal modeChanged

void QfExpressionEvaluator::modeChanged;

signal projectChanged

void QfExpressionEvaluator::projectChanged;

signal variablesChanged

void QfExpressionEvaluator::variablesChanged;

Public Functions Documentation

function QfExpressionEvaluator

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

function appExpressionContextScopesGenerator [2/2]

Returns the application expression context scopes generator object.

QfAppExpressionContextScopesGenerator * QfExpressionEvaluator::appExpressionContextScopesGenerator () const


function attributeFormModel [2/2]

Returns the attribute form model providing an expression context.

QfAttributeFormModel * QfExpressionEvaluator::attributeFormModel () const


function evaluate [1/2]

Evalutes and returns the current expression text property value.

Q_INVOKABLE QVariant QfExpressionEvaluator::evaluate () 


function evaluate [2/2]

Evalutes and returns the expression text passed as a parameter.

Q_INVOKABLE QVariant QfExpressionEvaluator::evaluate (
    const QString & expressionText
) 


function expressionText [2/2]

Returns the expression text used when evaluating.

inline QString QfExpressionEvaluator::expressionText () 


function feature [2/2]

Returns the feature attached to the expression context.

inline QgsFeature QfExpressionEvaluator::feature () const


function layer [2/2]

Returns the map layer attached to the expression context.

inline QgsMapLayer * QfExpressionEvaluator::layer () const


function mapSettings [2/2]

Returns the map settings attached to the expression context.

inline QgsQuickMapSettings * QfExpressionEvaluator::mapSettings () const


function mode [2/2]

Returns the expression evaluator mode.

inline Mode QfExpressionEvaluator::mode () const


function project [2/2]

Returns the project attached to the expression context.

inline QgsProject * QfExpressionEvaluator::project () const


function setAppExpressionContextScopesGenerator

Sets the application expression context scopes generator object.

void QfExpressionEvaluator::setAppExpressionContextScopesGenerator (
    QfAppExpressionContextScopesGenerator * generator
) 


function setAttributeFormModel

Sets the attribute form model providing an expression context.

void QfExpressionEvaluator::setAttributeFormModel (
    QfAttributeFormModel * attributeFormModel
) 


function setExpressionText

Sets the expression text used when evaluating.

void QfExpressionEvaluator::setExpressionText (
    const QString & expressionText
) 


function setFeature

Sets the feature attached to the expression context.

void QfExpressionEvaluator::setFeature (
    const QgsFeature & feature
) 


function setLayer

Sets the map layer attached to the expression context.

void QfExpressionEvaluator::setLayer (
    QgsMapLayer * layer
) 


function setMapSettings

Sets the map settings attached to the expression context.

void QfExpressionEvaluator::setMapSettings (
    QgsQuickMapSettings * mapSettings
) 


function setMode

Sets the expression evaluator mode .

void QfExpressionEvaluator::setMode (
    Mode mode
) 


function setProject

Sets the project attached to the expression context.

void QfExpressionEvaluator::setProject (
    QgsProject * project
) 


function setVariables

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

void QfExpressionEvaluator::setVariables (
    const QVariantMap & variables
) 


function variables [2/2]

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

inline QVariantMap QfExpressionEvaluator::variables () const



The documentation for this class was generated from the following file src/gui/qfexpressionevaluator.h