58 LoadUserExpressions = 1 << 2,
59 LoadAll = LoadRecent | LoadUserExpressions,
110 Q_DECL_DEPRECATED
void loadFieldsAndValues(
const QMap<QString, QStringList> &fieldValues )
SIP_DEPRECATED;
119 QString expressionText();
122 void setExpressionText(
const QString &expression );
129 QString expectedOutputFormat();
137 void setExpectedOutputFormat(
const QString &expected );
155 bool isExpressionValid();
172 void setCustomPreviewGenerator(
const QString &label,
const QList<QPair<QString, QVariant>> &choices,
const std::function<
QgsExpressionContext(
const QVariant & )> &previewContextGenerator );
188 void setCustomPreviewGenerator(
const QString &label,
const QList<QPair<QString, QVariant>> &choices, SIP_PYCALLABLE );
191 Py_BEGIN_ALLOW_THREADS
192 sipCpp->setCustomPreviewGenerator( *a0, *a1, [a2](
const QVariant &value ) ->
QgsExpressionContext {
195 PyObject *s = sipCallMethod( NULL, a2,
"D", &value, sipType_QVariant, NULL );
199 if ( sipIsError == 0 )
203 sipReleaseType( t1, sipType_QgsExpressionContext, state );
218 Q_DECL_DEPRECATED
void saveToRecent(
const QString &collection =
"generic" )
SIP_DEPRECATED;
225 Q_DECL_DEPRECATED
void loadRecent( const QString &collection = QStringLiteral( "generic" ) )
SIP_DEPRECATED;
245 Q_DECL_DEPRECATED
void saveToUserExpressions( const QString &label, const QString &expression, const QString &helpText )
SIP_DEPRECATED;
252 Q_DECL_DEPRECATED
void removeFromUserExpressions( const QString &label )
SIP_DEPRECATED;
257 void newFunctionFile( const QString &fileName = "scratch" );
262 void saveFunctionFile( QString fileName );
267 void loadCodeFromFile( QString path );
274 void loadCodeFromProjectFunctions();
279 void loadFunctionCode( const QString &code );
284 void updateFunctionFileList( const QString &path );
291 void saveProjectFunctionsEntry();
318 bool evalError() const;
325 bool parserError() const;
332 void setExpressionPreviewVisible(
bool isVisible );
341 void loadSampleValues();
348 void loadAllValues();
357 void loadSampleUsedValues();
366 void loadAllUsedValues();
378 void setAutoSave(
bool enabled ) { mAutoSave = enabled; }
384 void storeCurrentUserExpression();
391 void removeSelectedUserExpression();
398 void editSelectedUserExpression();
405 const QList<QgsExpressionItem *> findExpressions(
const QString &label );
409 void indicatorClicked(
int line,
int index, Qt::KeyboardModifiers state );
410 void onExpressionParsed(
bool state );
412 void operatorButtonClicked();
413 void btnRun_pressed();
414 void btnNewFile_pressed();
415 void btnRemoveFile_pressed();
422 void exportUserExpressions_pressed();
429 void importUserExpressions_pressed();
430 void cmbFileNames_currentItemChanged( QListWidgetItem *item, QListWidgetItem *lastitem );
431 void insertExpressionText(
const QString &text );
432 void txtExpressionString_textChanged();
433 void txtSearchEditValues_textChanged();
434 void mValuesListView_doubleClicked(
const QModelIndex &index );
435 void txtPython_textChanged();
462 void showEvent( QShowEvent *e )
override;
470 , mExpressionBuilderWidget( expressionBuilderWidget ) {}
478 int FUNCTION_MARKER_ID = 25;
480 void createErrorMarkers(
const QList<QgsExpression::ParserError> &errors );
482 void clearFunctionMarkers();
484 void runPythonCode(
const QString &code );
486 void fillFieldValues(
const QString &fieldName,
QgsVectorLayer *layer,
int countLimit,
bool forceUsedValues =
false );
489 QString helpStylesheet()
const;
492 void expressionContextUpdated();
497 std::unique_ptr<QStandardItemModel> mValuesModel;
498 std::unique_ptr<QSortFilterProxyModel> mProxyValues;
500 ExpressionTreeMenuProvider *mExpressionTreeMenuProvider =
nullptr;
502 bool mAutoSave =
true;
503 QString mFunctionsPath;
505 bool mExpressionValid =
false;
507 QPointer<QgsProject> mProject;
510 QString mUserExpressionsGroupName;
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...