Skip to content

Commit 7d92641

Browse files
committed
Add QString operator to QgsExpression
1 parent 58bfbd5 commit 7d92641

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

python/core/expression/qgsexpression.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Implicit sharing was added in 2.14
9898
%End
9999

100100

101+
101102
QgsExpression();
102103
%Docstring
103104
Create an empty expression.

src/core/expression/qgsexpression.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ QgsExpression &QgsExpression::operator=( const QgsExpression &other )
218218
return *this;
219219
}
220220

221+
QgsExpression::operator QString() const
222+
{
223+
return d->mExp;
224+
}
225+
221226
QgsExpression::QgsExpression()
222227
: d( new QgsExpressionPrivate )
223228
{

src/core/expression/qgsexpression.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,13 @@ class CORE_EXPORT QgsExpression
137137
*/
138138
QgsExpression &operator=( const QgsExpression &other );
139139

140+
/**
141+
* Automatically convert this expression to a string where requested.
142+
*
143+
* \since QGIS 3.0
144+
*/
145+
operator QString() const SIP_SKIP;
146+
140147
/**
141148
* Create an empty expression.
142149
*

0 commit comments

Comments
 (0)