Skip to content

Commit

Permalink
Add QString operator to QgsExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Nov 22, 2017
1 parent 58bfbd5 commit 7d92641
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/core/expression/qgsexpression.sip
Expand Up @@ -98,6 +98,7 @@ Implicit sharing was added in 2.14
%End



QgsExpression();
%Docstring
Create an empty expression.
Expand Down
5 changes: 5 additions & 0 deletions src/core/expression/qgsexpression.cpp
Expand Up @@ -218,6 +218,11 @@ QgsExpression &QgsExpression::operator=( const QgsExpression &other )
return *this;
}

QgsExpression::operator QString() const
{
return d->mExp;
}

QgsExpression::QgsExpression()
: d( new QgsExpressionPrivate )
{
Expand Down
7 changes: 7 additions & 0 deletions src/core/expression/qgsexpression.h
Expand Up @@ -137,6 +137,13 @@ class CORE_EXPORT QgsExpression
*/
QgsExpression &operator=( const QgsExpression &other );

/**
* Automatically convert this expression to a string where requested.
*
* \since QGIS 3.0
*/
operator QString() const SIP_SKIP;

/**
* Create an empty expression.
*
Expand Down

0 comments on commit 7d92641

Please sign in to comment.