59 LoadUserExpressions = 1 << 2,
60 LoadAll = LoadRecent | LoadUserExpressions,
111 Q_DECL_DEPRECATED
void loadFieldsAndValues(
const QMap<QString, QStringList> &fieldValues )
SIP_DEPRECATED;
120 QString expressionText();
123 void setExpressionText(
const QString &expression );
130 QString expectedOutputFormat();
138 void setExpectedOutputFormat(
const QString &expected );
156 bool isExpressionValid();
173 void setCustomPreviewGenerator(
const QString &label,
const QList< QPair< QString, QVariant > > &choices,
const std::function<
QgsExpressionContext(
const QVariant & ) > &previewContextGenerator );
189 void setCustomPreviewGenerator(
const QString &label,
const QList< QPair< QString, QVariant > > &choices, SIP_PYCALLABLE );
192 Py_BEGIN_ALLOW_THREADS
193 sipCpp->setCustomPreviewGenerator( *a0, *a1, [a2](
const QVariant &value )->
QgsExpressionContext
197 PyObject *s = sipCallMethod( NULL, a2,
"D", &value, sipType_QVariant, NULL );
201 if ( sipIsError == 0 )
205 sipReleaseType( t1, sipType_QgsExpressionContext, state );
220 Q_DECL_DEPRECATED
void saveToRecent(
const QString &collection =
"generic" )
SIP_DEPRECATED;
227 Q_DECL_DEPRECATED
void loadRecent( const QString &collection = QStringLiteral( "generic" ) )
SIP_DEPRECATED ;
247 Q_DECL_DEPRECATED
void saveToUserExpressions( const QString &label, const QString &expression, const QString &helpText )
SIP_DEPRECATED;
254 Q_DECL_DEPRECATED
void removeFromUserExpressions( const QString &label )
SIP_DEPRECATED;
259 void newFunctionFile( const QString &fileName = "scratch" );
264 void saveFunctionFile( QString fileName );
269 void loadCodeFromFile( QString path );
276 void loadCodeFromProjectFunctions();
281 void loadFunctionCode( const QString &code );
286 void updateFunctionFileList( const QString &path );
293 void saveProjectFunctionsEntry();
320 bool evalError() const;
327 bool parserError() const;
334 void setExpressionPreviewVisible(
bool isVisible );
343 void loadSampleValues();
350 void loadAllValues();
359 void loadSampleUsedValues();
368 void loadAllUsedValues();
380 void setAutoSave(
bool enabled ) { mAutoSave = enabled; }
386 void storeCurrentUserExpression( );
393 void removeSelectedUserExpression( );
400 void editSelectedUserExpression();
407 const QList<QgsExpressionItem *> findExpressions(
const QString &label );
411 void indicatorClicked(
int line,
int index, Qt::KeyboardModifiers state );
412 void onExpressionParsed(
bool state );
414 void operatorButtonClicked();
415 void btnRun_pressed();
416 void btnNewFile_pressed();
417 void btnRemoveFile_pressed();
424 void exportUserExpressions_pressed();
431 void importUserExpressions_pressed();
432 void cmbFileNames_currentItemChanged( QListWidgetItem *item, QListWidgetItem *lastitem );
433 void insertExpressionText(
const QString &text );
434 void txtExpressionString_textChanged();
435 void txtSearchEditValues_textChanged();
436 void mValuesListView_doubleClicked(
const QModelIndex &index );
437 void txtPython_textChanged();
464 void showEvent( QShowEvent *e )
override;
472 , mExpressionBuilderWidget( expressionBuilderWidget ) {}
480 int FUNCTION_MARKER_ID = 25;
482 void createErrorMarkers(
const QList<QgsExpression::ParserError> &errors );
484 void clearFunctionMarkers();
486 void runPythonCode(
const QString &code );
488 void fillFieldValues(
const QString &fieldName,
QgsVectorLayer *layer,
int countLimit,
bool forceUsedValues =
false );
491 QString helpStylesheet()
const;
494 void expressionContextUpdated();
499 std::unique_ptr<QStandardItemModel> mValuesModel;
500 std::unique_ptr<QSortFilterProxyModel> mProxyValues;
502 ExpressionTreeMenuProvider *mExpressionTreeMenuProvider =
nullptr;
504 bool mAutoSave =
true;
505 QString mFunctionsPath;
508 bool mExpressionValid =
false;
510 QPointer< QgsProject > mProject;
513 QString mUserExpressionsGroupName;
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...