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 )
53 Q_PROPERTY(
bool buttonVisible READ buttonVisible WRITE setButtonVisible NOTIFY buttonVisibleChanged )
63 void setExpressionDialogTitle( const QString &title );
75 const QString expressionDialogTitle() {
return mExpressionDialogTitle; }
78 void setFilters( QgsFieldProxyModel::Filters filters );
85 void setAllowEmptyFieldName(
bool allowEmpty );
92 bool allowEmptyFieldName()
const;
94 void setLeftHandButtonStyle(
bool isLeft );
97 QgsFieldProxyModel::Filters
filters()
const {
return mFieldProxyModel->filters(); }
107 QString currentField(
bool *isExpression =
nullptr,
bool *isValid =
nullptr )
const;
112 bool isValidExpression( QString *expressionError =
nullptr )
const;
117 bool isExpression()
const;
122 QString currentText()
const;
129 QString asExpression()
const;
139 QString expression()
const;
160 bool allowEvalErrors()
const;
167 void setAllowEvalErrors(
bool allowEvalErrors );
176 bool buttonVisible()
const;
185 void setButtonVisible(
bool visible );
217 void setRow(
int row ) { mCombo->setCurrentIndex( row ); }
220 void setField(
const QString &fieldName );
226 void setFields(
const QgsFields &fields );
233 void setExpression(
const QString &expression );
237 void editExpression();
240 void expressionEdited(
const QString &expression );
243 void expressionEditingFinished();
245 void currentFieldChanged();
252 void updateLineEditStyle(
const QString &expression = QString() );
254 bool isExpressionValid(
const QString &expressionStr );
257 void changeEvent( QEvent *event )
override;
259 bool eventFilter( QObject *watched, QEvent *event )
override;
264 void beforeResetModel();
265 void afterResetModel();
268 QComboBox *mCombo =
nullptr;
269 QToolButton *mButton =
nullptr;
271 QString mExpressionDialogTitle;
272 std::shared_ptr<const QgsDistanceArea> mDistanceArea;
275 QString mBackupExpression;
276 bool mAllowEvalErrors =
false;
278 friend class TestQgsFieldExpressionWidget;
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...