QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
QgsExpressionBuilderDialog Class Reference

A generic dialog for building expression strings. More...

#include <qgsexpressionbuilderdialog.h>

Inheritance diagram for QgsExpressionBuilderDialog:
Inheritance graph
[legend]

Signals

void allowEvalErrorsChanged ()
 Allow accepting expressions with evaluation errors. More...
 

Public Member Functions

 QgsExpressionBuilderDialog (QgsVectorLayer *layer, const QString &startText=QString(), QWidget *parent SIP_TRANSFERTHIS=nullptr, const QString &key="generic", const QgsExpressionContext &context=QgsExpressionContext())
 
bool allowEvalErrors () const
 Allow accepting invalid expressions. More...
 
QString expectedOutputFormat ()
 Returns the expected format string, which is shown in the dialog. More...
 
QgsExpressionBuilderWidgetexpressionBuilder ()
 The builder widget that is used by the dialog. More...
 
QgsExpressionContext expressionContext () const
 Returns the expression context for the dialog. More...
 
QString expressionText ()
 
void setAllowEvalErrors (bool allowEvalErrors)
 Allow accepting expressions with evaluation errors. More...
 
void setExpectedOutputFormat (const QString &expected)
 Set the expected format string, which is shown in the dialog. More...
 
void setExpressionContext (const QgsExpressionContext &context)
 Sets the expression context for the dialog. More...
 
void setExpressionText (const QString &text)
 
void setGeomCalculator (const QgsDistanceArea &da)
 Sets geometry calculator used in distance/area calculations. More...
 

Protected Member Functions

void accept () override
 
void done (int r) override
 Is called when the dialog get accepted or rejected Used to save geometry. More...
 

Properties

bool allowEvalErrors
 

Detailed Description

A generic dialog for building expression strings.

Remarks
This class also shows an example on how to use QgsExpressionBuilderWidget

Definition at line 30 of file qgsexpressionbuilderdialog.h.

Constructor & Destructor Documentation

◆ QgsExpressionBuilderDialog()

QgsExpressionBuilderDialog::QgsExpressionBuilderDialog ( QgsVectorLayer layer,
const QString &  startText = QString(),
QWidget *parent  SIP_TRANSFERTHIS = nullptr,
const QString &  key = "generic",
const QgsExpressionContext context = QgsExpressionContext() 
)

Definition at line 21 of file qgsexpressionbuilderdialog.cpp.

Member Function Documentation

◆ accept()

void QgsExpressionBuilderDialog::accept ( )
overrideprotected

Definition at line 80 of file qgsexpressionbuilderdialog.cpp.

◆ allowEvalErrors()

bool QgsExpressionBuilderDialog::allowEvalErrors ( ) const

Allow accepting invalid expressions.

This can be useful when we are not able to provide an expression context of which we are sure it's completely populated.

Since
QGIS 3.0

Definition at line 92 of file qgsexpressionbuilderdialog.cpp.

◆ allowEvalErrorsChanged

void QgsExpressionBuilderDialog::allowEvalErrorsChanged ( )
signal

Allow accepting expressions with evaluation errors.

This can be useful when we are not able to provide an expression context of which we are sure it's completely populated.

Since
QGIS 3.0

◆ done()

void QgsExpressionBuilderDialog::done ( int  r)
overrideprotected

Is called when the dialog get accepted or rejected Used to save geometry.

Parameters
rresult value (unused)

Definition at line 75 of file qgsexpressionbuilderdialog.cpp.

◆ expectedOutputFormat()

QString QgsExpressionBuilderDialog::expectedOutputFormat ( )

Returns the expected format string, which is shown in the dialog.

This is purely a text format and no expression validation is done against it.

See also
setExpectedOutputFormat()

Definition at line 55 of file qgsexpressionbuilderdialog.cpp.

◆ expressionBuilder()

QgsExpressionBuilderWidget * QgsExpressionBuilderDialog::expressionBuilder ( )

The builder widget that is used by the dialog.

Definition at line 40 of file qgsexpressionbuilderdialog.cpp.

◆ expressionContext()

QgsExpressionContext QgsExpressionBuilderDialog::expressionContext ( ) const

Returns the expression context for the dialog.

The context is used for the expression preview result and for populating the list of available functions and variables.

See also
setExpressionContext
Since
QGIS 2.12

Definition at line 65 of file qgsexpressionbuilderdialog.cpp.

◆ expressionText()

QString QgsExpressionBuilderDialog::expressionText ( )

Definition at line 50 of file qgsexpressionbuilderdialog.cpp.

◆ setAllowEvalErrors()

void QgsExpressionBuilderDialog::setAllowEvalErrors ( bool  allowEvalErrors)

Allow accepting expressions with evaluation errors.

This can be useful when we are not able to provide an expression context of which we are sure it's completely populated.

Since
QGIS 3.0

Definition at line 97 of file qgsexpressionbuilderdialog.cpp.

◆ setExpectedOutputFormat()

void QgsExpressionBuilderDialog::setExpectedOutputFormat ( const QString &  expected)

Set the expected format string, which is shown in the dialog.

This is purely a text format and no expression validation is done against it.

See also
expectedOutputFormat()

Definition at line 60 of file qgsexpressionbuilderdialog.cpp.

◆ setExpressionContext()

void QgsExpressionBuilderDialog::setExpressionContext ( const QgsExpressionContext context)

Sets the expression context for the dialog.

The context is used for the expression preview result and for populating the list of available functions and variables.

Parameters
contextexpression context
See also
expressionContext
Since
QGIS 2.12

Definition at line 70 of file qgsexpressionbuilderdialog.cpp.

◆ setExpressionText()

void QgsExpressionBuilderDialog::setExpressionText ( const QString &  text)

Definition at line 45 of file qgsexpressionbuilderdialog.cpp.

◆ setGeomCalculator()

void QgsExpressionBuilderDialog::setGeomCalculator ( const QgsDistanceArea da)

Sets geometry calculator used in distance/area calculations.

Definition at line 86 of file qgsexpressionbuilderdialog.cpp.

Property Documentation

◆ allowEvalErrors

bool QgsExpressionBuilderDialog::allowEvalErrors
readwrite

Definition at line 1 of file qgsexpressionbuilderdialog.h.


The documentation for this class was generated from the following files: