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; }
85 void setAllowEmptyFieldName(
bool allowEmpty );
92 bool allowEmptyFieldName()
const;
94 void setLeftHandButtonStyle(
bool isLeft );
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;
170 void setCustomPreviewGenerator(
const QString &label,
const QList< QPair< QString, QVariant > > &choices,
const std::function<
QgsExpressionContext(
const QVariant & ) > &previewContextGenerator );
186 void setCustomPreviewGenerator(
const QString &label,
const QList< QPair< QString, QVariant > > &choices, SIP_PYCALLABLE );
189 Py_BEGIN_ALLOW_THREADS
190 sipCpp->setCustomPreviewGenerator( *a0, *a1, [a2](
const QVariant &value )->
QgsExpressionContext
194 PyObject *s = sipCallMethod( NULL, a2,
"D", &value, sipType_QVariant, NULL );
198 if ( sipIsError == 0 )
202 sipReleaseType( t1, sipType_QgsExpressionContext, state );
216 bool allowEvalErrors()
const;
223 void setAllowEvalErrors(
bool allowEvalErrors );
232 bool buttonVisible()
const;
241 void setButtonVisible(
bool visible );
273 void setRow(
int row ) { mCombo->setCurrentIndex( row ); }
276 void setField(
const QString &fieldName );
282 void setFields(
const QgsFields &fields );
289 void setExpression(
const QString &expression );
293 void editExpression();
296 void expressionEdited(
const QString &expression );
299 void expressionEditingFinished();
301 void currentFieldChanged();
308 void updateLineEditStyle(
const QString &expression = QString() );
310 bool isExpressionValid(
const QString &expressionStr );
313 void changeEvent( QEvent *event )
override;
315 bool eventFilter( QObject *watched, QEvent *event )
override;
320 void beforeResetModel();
321 void afterResetModel();
324 QComboBox *mCombo =
nullptr;
325 QToolButton *mButton =
nullptr;
327 QString mExpressionDialogTitle;
328 std::shared_ptr<const QgsDistanceArea> mDistanceArea;
331 QString mBackupExpression;
332 bool mAllowEvalErrors =
false;
334 QString mCustomPreviewLabel;
335 QList< QPair< QString, QVariant > > mCustomChoices;
338 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...