Navigation Menu

Skip to content

Commit

Permalink
New method to add a scope to the current context
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Apr 26, 2018
1 parent 4f4844f commit b13ba37
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions python/gui/qgsfieldexpressionwidget.sip.in
Expand Up @@ -36,6 +36,15 @@ only when editing in the line edit is finished (focus lost, enter key pressed).
void setExpressionDialogTitle( const QString &title );
%Docstring
define the title used in the expression dialog
%End

void appendScope( QgsExpressionContextScope *scope /Transfer/ );
%Docstring
Appends a scope to the current expression context.

:param scope: The scope to add.

.. versionadded:: 3.2
%End

const QString expressionDialogTitle();
Expand Down
5 changes: 5 additions & 0 deletions src/gui/qgsfieldexpressionwidget.cpp
Expand Up @@ -346,3 +346,8 @@ bool QgsFieldExpressionWidget::isExpressionValid( const QString &expressionStr )
expression.prepare( &mExpressionContext );
return !expression.hasParserError();
}

void QgsFieldExpressionWidget::appendScope( QgsExpressionContextScope *scope )
{
mExpressionContext.appendScope( scope );
}
9 changes: 9 additions & 0 deletions src/gui/qgsfieldexpressionwidget.h
Expand Up @@ -60,6 +60,15 @@ class GUI_EXPORT QgsFieldExpressionWidget : public QWidget
//! define the title used in the expression dialog
void setExpressionDialogTitle( const QString &title );

/**
* Appends a scope to the current expression context.
*
* \param scope The scope to add.
*
* \since QGIS 3.2
*/
void appendScope( QgsExpressionContextScope *scope SIP_TRANSFER );

//! return the title used for the expression dialog
const QString expressionDialogTitle() { return mExpressionDialogTitle; }

Expand Down

0 comments on commit b13ba37

Please sign in to comment.