31 builder->setExpressionContext( context );
32 builder->setLayer( layer );
33 builder->setExpressionText( startText );
34 builder->loadFieldNames();
35 builder->loadRecent( mRecentKey );
37 connect( buttonBox, &QDialogButtonBox::helpRequested,
this, &QgsExpressionBuilderDialog::showHelp );
47 builder->setExpressionText( text );
52 return builder->expressionText();
57 return builder->expressionContext();
62 builder->setExpressionContext( context );
72 builder->saveToRecent( mRecentKey );
79 builder->setGeomCalculator( da );
84 return mAllowEvalErrors;
89 if ( allowEvalErrors == mAllowEvalErrors )
93 syncOkButtonEnabledState();
97 void QgsExpressionBuilderDialog::showHelp()
102 void QgsExpressionBuilderDialog::syncOkButtonEnabledState()
104 QPushButton *okButton = buttonBox->button( QDialogButtonBox::Ok );
106 if ( builder->parserError() )
107 okButton->setEnabled(
false );
108 else if ( !builder->evalError() || mAllowEvalErrors )
109 okButton->setEnabled(
true );
111 okButton->setEnabled(
true );
void setExpressionText(const QString &text)
QgsExpressionBuilderDialog(QgsVectorLayer *layer, const QString &startText=QString(), QWidget *parent SIP_TRANSFERTHIS=nullptr, const QString &key="generic", const QgsExpressionContext &context=QgsExpressionContext())
QgsExpressionBuilderWidget * expressionBuilder()
The builder widget that is used by the dialog.
static QgsGui * instance()
Returns a pointer to the singleton instance.
QgsExpressionContext expressionContext() const
Returns the expression context for the dialog.
void setAllowEvalErrors(bool allowEvalErrors)
Allow accepting expressions with evaluation errors.
void allowEvalErrorsChanged()
Allow accepting expressions with evaluation errors.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context for the dialog.
void setGeomCalculator(const QgsDistanceArea &da)
Sets geometry calculator used in distance/area calculations.
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.
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.
bool allowEvalErrors() const
Allow accepting invalid expressions.
Represents a vector layer which manages a vector based data sets.