31 builder->setExpressionContext( context );
32 builder->setLayer( layer );
33 builder->setExpressionText( startText );
34 builder->expressionTree()->loadRecent( mRecentKey );
35 builder->expressionTree()->loadUserExpressions( );
37 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsExpressionBuilderDialog::showHelp );
47 builder->setExpressionText( text );
52 return builder->expressionText();
57 return builder->expectedOutputFormat();
62 builder->setExpectedOutputFormat( expected );
67 return builder->expressionContext();
72 builder->setExpressionContext( context );
82 builder->expressionTree()->saveToRecent( builder->expressionText(), mRecentKey );
89 builder->setGeomCalculator( da );
94 return mAllowEvalErrors;
103 syncOkButtonEnabledState();
107 void QgsExpressionBuilderDialog::showHelp()
112 void QgsExpressionBuilderDialog::syncOkButtonEnabledState()
114 QPushButton *okButton = buttonBox->button( QDialogButtonBox::Ok );
116 if ( builder->parserError() )
117 okButton->setEnabled(
false );
118 else if ( !builder->evalError() || mAllowEvalErrors )
119 okButton->setEnabled(
true );
121 okButton->setEnabled(
true );
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
void done(int r) override
Is called when the dialog get accepted or rejected Used to save geometry.
void setGeomCalculator(const QgsDistanceArea &da)
Sets geometry calculator used in distance/area calculations.
QgsExpressionBuilderDialog(QgsVectorLayer *layer, const QString &startText=QString(), QWidget *parent SIP_TRANSFERTHIS=nullptr, const QString &key="generic", const QgsExpressionContext &context=QgsExpressionContext())
void setExpressionText(const QString &text)
void setExpectedOutputFormat(const QString &expected)
Set the expected format string, which is shown in the dialog.
QgsExpressionBuilderWidget * expressionBuilder()
The builder widget that is used by the dialog.
void allowEvalErrorsChanged()
Allow accepting expressions with evaluation errors.
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context for the dialog.
void setAllowEvalErrors(bool allowEvalErrors)
Allow accepting expressions with evaluation errors.
QString expectedOutputFormat()
Returns the expected format string, which is shown in the dialog.
QgsExpressionContext expressionContext() const
Returns the expression context for the dialog.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
Represents a vector layer which manages a vector based data sets.