16 #ifndef QGSFIELDEXPRESSIONWIDGET_H 17 #define QGSFIELDEXPRESSIONWIDGET_H 21 #include <QToolButton> 49 Q_PROPERTY( QString expressionDialogTitle READ expressionDialogTitle WRITE setExpressionDialogTitle )
51 Q_PROPERTY(
bool allowEvalErrors READ allowEvalErrors WRITE setAllowEvalErrors NOTIFY allowEvalErrorsChanged )
61 void setExpressionDialogTitle( const QString &title );
73 const QString expressionDialogTitle() {
return mExpressionDialogTitle; }
76 void setFilters( QgsFieldProxyModel::Filters filters );
78 void setLeftHandButtonStyle(
bool isLeft );
81 QgsFieldProxyModel::Filters
filters()
const {
return mFieldProxyModel->filters(); }
91 QString currentField(
bool *isExpression =
nullptr,
bool *isValid =
nullptr )
const;
96 bool isValidExpression( QString *expressionError =
nullptr )
const;
101 bool isExpression()
const;
106 QString currentText()
const;
114 QString asExpression()
const;
125 QString expression()
const;
148 bool allowEvalErrors()
const;
156 void setAllowEvalErrors(
bool allowEvalErrors );
160 void fieldChanged(
const QString &fieldName );
163 void fieldChanged(
const QString &fieldName,
bool isValid );
171 void allowEvalErrorsChanged();
182 void setRow(
int row ) { mCombo->setCurrentIndex( row ); }
185 void setField(
const QString &fieldName );
193 void setExpression(
const QString &expression );
197 void editExpression();
200 void expressionEdited(
const QString &expression );
203 void expressionEditingFinished();
205 void currentFieldChanged();
212 void updateLineEditStyle(
const QString &expression = QString() );
214 bool isExpressionValid(
const QString &expressionStr );
217 void changeEvent( QEvent *event )
override;
222 void beforeResetModel();
223 void afterResetModel();
226 QComboBox *mCombo =
nullptr;
227 QToolButton *mButton =
nullptr;
229 QString mExpressionDialogTitle;
230 std::shared_ptr<const QgsDistanceArea> mDa;
233 QString mBackupExpression;
234 bool mAllowEvalErrors =
false;
236 friend class TestQgsFieldExpressionWidget;
239 #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.