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 );
64 const QString expressionDialogTitle() {
return mExpressionDialogTitle; }
67 void setFilters( QgsFieldProxyModel::Filters filters );
69 void setLeftHandButtonStyle(
bool isLeft );
72 QgsFieldProxyModel::Filters
filters()
const {
return mFieldProxyModel->filters(); }
82 QString currentField(
bool *isExpression =
nullptr,
bool *isValid =
nullptr )
const;
87 bool isValidExpression( QString *expressionError =
nullptr )
const;
92 bool isExpression()
const;
97 QString currentText()
const;
105 QString asExpression()
const;
116 QString expression()
const;
139 bool allowEvalErrors()
const;
147 void setAllowEvalErrors(
bool allowEvalErrors );
151 void fieldChanged(
const QString &fieldName );
154 void fieldChanged(
const QString &fieldName,
bool isValid );
162 void allowEvalErrorsChanged();
173 void setRow(
int row ) { mCombo->setCurrentIndex( row ); }
176 void setField(
const QString &fieldName );
184 void setExpression(
const QString &expression );
188 void editExpression();
191 void expressionEdited(
const QString &expression );
194 void expressionEditingFinished();
196 void currentFieldChanged();
203 void updateLineEditStyle(
const QString &expression = QString() );
205 bool isExpressionValid(
const QString &expressionStr );
208 void changeEvent( QEvent *event )
override;
213 void beforeResetModel();
214 void afterResetModel();
217 QComboBox *mCombo =
nullptr;
218 QToolButton *mButton =
nullptr;
220 QString mExpressionDialogTitle;
221 std::shared_ptr<const QgsDistanceArea> mDa;
224 QString mBackupExpression;
225 bool mAllowEvalErrors =
false;
227 friend class TestQgsFieldExpressionWidget;
230 #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...
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.