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 sipCpp->setCustomPreviewGenerator( *a0, *a1, [a2](
const QVariant &value ) ->
QgsExpressionContext {
193 PyObject *s = sipCallMethod( NULL, a2,
"D", &value, sipType_QVariant, NULL );
197 if ( sipIsError == 0 )
201 sipReleaseType( t1, sipType_QgsExpressionContext, state );
215 bool allowEvalErrors()
const;
222 void setAllowEvalErrors(
bool allowEvalErrors );
231 bool buttonVisible()
const;
240 void setButtonVisible(
bool visible );
272 void setRow(
int row ) { mCombo->setCurrentIndex( row ); }
275 void setField(
const QString &fieldName );
281 void setFields(
const QgsFields &fields );
288 void setExpression(
const QString &expression );
292 void editExpression();
295 void expressionEdited(
const QString &expression );
298 void expressionEditingFinished();
300 void currentFieldChanged();
307 void updateLineEditStyle(
const QString &expression = QString() );
309 bool isExpressionValid(
const QString &expressionStr );
312 void changeEvent( QEvent *event )
override;
314 bool eventFilter( QObject *watched, QEvent *event )
override;
319 void beforeResetModel();
320 void afterResetModel();
323 QComboBox *mCombo =
nullptr;
324 QToolButton *mButton =
nullptr;
326 QString mExpressionDialogTitle;
327 std::shared_ptr<const QgsDistanceArea> mDistanceArea;
330 QString mBackupExpression;
331 bool mAllowEvalErrors =
false;
333 QString mCustomPreviewLabel;
334 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.