16#ifndef QGSFIELDEXPRESSIONWIDGET_H
17#define QGSFIELDEXPRESSIONWIDGET_H
87 void setAllowEmptyFieldName(
bool allowEmpty );
94 bool allowEmptyFieldName()
const;
96 void setLeftHandButtonStyle(
bool isLeft );
109 QString currentField(
bool *isExpression =
nullptr,
bool *isValid =
nullptr )
const;
114 bool isValidExpression( QString *expressionError =
nullptr )
const;
119 bool isExpression()
const;
124 QString currentText()
const;
131 QString asExpression()
const;
141 QString expression()
const;
172 void setCustomPreviewGenerator(
const QString &label,
const QList<QPair<QString, QVariant>> &choices,
const std::function<
QgsExpressionContext(
const QVariant & )> &previewContextGenerator );
188 void setCustomPreviewGenerator(
const QString &label,
const QList<QPair<QString, QVariant>> &choices, SIP_PYCALLABLE );
191 Py_BEGIN_ALLOW_THREADS
192 sipCpp->setCustomPreviewGenerator( *a0, *a1, [a2](
const QVariant &value ) ->
QgsExpressionContext {
195 PyObject *s = sipCallMethod( NULL, a2,
"D", &value, sipType_QVariant, NULL );
199 if ( sipIsError == 0 )
203 sipReleaseType( t1, sipType_QgsExpressionContext, state );
217 bool allowEvalErrors()
const;
224 void setAllowEvalErrors(
bool allowEvalErrors );
233 bool buttonVisible()
const;
242 void setButtonVisible(
bool visible );
274 void setRow(
int row ) { mCombo->setCurrentIndex( row ); }
277 void setField(
const QString &fieldName );
283 void setFields(
const QgsFields &fields );
290 void setExpression(
const QString &expression );
294 void editExpression();
297 void expressionEdited(
const QString &expression );
300 void expressionEditingFinished();
302 void currentFieldChanged();
309 void updateLineEditStyle(
const QString &expression = QString() );
311 bool isExpressionValid(
const QString &expressionStr );
314 void changeEvent( QEvent *event )
override;
316 bool eventFilter( QObject *watched, QEvent *event )
override;
321 void beforeResetModel();
322 void afterResetModel();
325 QComboBox *mCombo =
nullptr;
326 QToolButton *mButton =
nullptr;
328 QString mExpressionDialogTitle;
329 std::shared_ptr<const QgsDistanceArea> mDistanceArea;
332 QString mBackupExpression;
333 bool mAllowEvalErrors =
false;
335 QString mCustomPreviewLabel;
336 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.