16#ifndef QGSFIELDEXPRESSIONWIDGET_H
17#define QGSFIELDEXPRESSIONWIDGET_H
86 void setAllowEmptyFieldName(
bool allowEmpty );
93 bool allowEmptyFieldName()
const;
95 void setLeftHandButtonStyle(
bool isLeft );
108 QString currentField(
bool *isExpression =
nullptr,
bool *isValid =
nullptr )
const;
113 bool isValidExpression( QString *expressionError =
nullptr )
const;
118 bool isExpression()
const;
123 QString currentText()
const;
130 QString asExpression()
const;
140 QString expression()
const;
171 void setCustomPreviewGenerator(
const QString &label,
const QList<QPair<QString, QVariant>> &choices,
const std::function<
QgsExpressionContext(
const QVariant & )> &previewContextGenerator );
187 void setCustomPreviewGenerator(
const QString &label,
const QList<QPair<QString, QVariant>> &choices, SIP_PYCALLABLE );
190 Py_BEGIN_ALLOW_THREADS
191 sipCpp->setCustomPreviewGenerator( *a0, *a1, [a2](
const QVariant &value ) ->
QgsExpressionContext {
194 PyObject *s = sipCallMethod( NULL, a2,
"D", &value, sipType_QVariant, NULL );
198 if ( sipIsError == 0 )
202 sipReleaseType( t1, sipType_QgsExpressionContext, state );
216 bool allowEvalErrors()
const;
223 void setAllowEvalErrors(
bool allowEvalErrors );
232 bool buttonVisible()
const;
241 void setButtonVisible(
bool visible );
273 void setRow(
int row ) { mCombo->setCurrentIndex( row ); }
276 void setField(
const QString &fieldName );
282 void setFields(
const QgsFields &fields );
289 void setExpression(
const QString &expression );
293 void editExpression();
296 void expressionEdited(
const QString &expression );
299 void expressionEditingFinished();
301 void currentFieldChanged();
308 void updateLineEditStyle(
const QString &expression = QString() );
310 bool isExpressionValid(
const QString &expressionStr );
313 void changeEvent( QEvent *event )
override;
315 bool eventFilter( QObject *watched, QEvent *event )
override;
320 void beforeResetModel();
321 void afterResetModel();
324 QComboBox *mCombo =
nullptr;
325 QToolButton *mButton =
nullptr;
327 QString mExpressionDialogTitle;
328 std::shared_ptr<const QgsDistanceArea> mDistanceArea;
331 QString mBackupExpression;
332 bool mAllowEvalErrors =
false;
334 QString mCustomPreviewLabel;
335 QList<QPair<QString, QVariant>> mCustomChoices;
A general purpose distance and area calculator, capable of performing ellipsoid based calculations.
Abstract interface for generating an expression context.
Single scope for storing variables and functions for use within a QgsExpressionContext.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A proxy model to filter the list of fields of a layer.
Container of fields for a vector layer.
Base class for all map layer types.
Represents a vector layer which manages a vector based dataset.