16 #ifndef QGSFIELDEXPRESSIONWIDGET_H 17 #define QGSFIELDEXPRESSIONWIDGET_H 21 #include <QToolButton> 49 Q_PROPERTY( QString expressionDialogTitle READ expressionDialogTitle WRITE setExpressionDialogTitle )
51 Q_PROPERTY(
bool allowEmptyFieldName READ allowEmptyFieldName WRITE setAllowEmptyFieldName )
52 Q_PROPERTY(
bool allowEvalErrors READ allowEvalErrors WRITE setAllowEvalErrors NOTIFY allowEvalErrorsChanged )
62 void setExpressionDialogTitle( const QString &title );
74 const QString expressionDialogTitle() {
return mExpressionDialogTitle; }
77 void setFilters( QgsFieldProxyModel::Filters filters );
84 void setAllowEmptyFieldName(
bool allowEmpty );
91 bool allowEmptyFieldName()
const;
93 void setLeftHandButtonStyle(
bool isLeft );
96 QgsFieldProxyModel::Filters
filters()
const {
return mFieldProxyModel->filters(); }
106 QString currentField(
bool *isExpression =
nullptr,
bool *isValid =
nullptr )
const;
111 bool isValidExpression( QString *expressionError =
nullptr )
const;
116 bool isExpression()
const;
121 QString currentText()
const;
129 QString asExpression()
const;
140 QString expression()
const;
163 bool allowEvalErrors()
const;
171 void setAllowEvalErrors(
bool allowEvalErrors );
175 void fieldChanged(
const QString &fieldName );
178 void fieldChanged(
const QString &fieldName,
bool isValid );
186 void allowEvalErrorsChanged();
197 void setRow(
int row ) { mCombo->setCurrentIndex( row ); }
200 void setField(
const QString &fieldName );
208 void setExpression(
const QString &expression );
212 void editExpression();
215 void expressionEdited(
const QString &expression );
218 void expressionEditingFinished();
220 void currentFieldChanged();
227 void updateLineEditStyle(
const QString &expression = QString() );
229 bool isExpressionValid(
const QString &expressionStr );
232 void changeEvent( QEvent *event )
override;
234 bool eventFilter( QObject *watched, QEvent *event )
override;
239 void beforeResetModel();
240 void afterResetModel();
243 QComboBox *mCombo =
nullptr;
244 QToolButton *mButton =
nullptr;
246 QString mExpressionDialogTitle;
247 std::shared_ptr<const QgsDistanceArea> mDa;
250 QString mBackupExpression;
251 bool mAllowEvalErrors =
false;
253 friend class TestQgsFieldExpressionWidget;
256 #endif // QGSFIELDEXPRESSIONWIDGET_H
Base class for all map layer types.
The QgsFieldProxyModel class provides an easy to use model to display the list of fields of a layer...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Single scope for storing variables and functions for use within a QgsExpressionContext.
Abstract interface for generating an expression context.
A general purpose distance and area calculator, capable of performing ellipsoid based calculations...
Represents a vector layer which manages a vector based data sets.