-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
Also improve the API for QgsExpressionContextUtils::updateSymbolScope Previously it was hard to predict if the method would create storage, which caused issues for the python bindings (eg, they had a choice of either leaking or being crashy).
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -345,9 +345,9 @@ class QgsExpressionContext | |
void appendScope( QgsExpressionContextScope* scope /Transfer/ ); | ||
|
||
/** | ||
* Remove the last scope from the expression context. | ||
* Removes the last scope from the expression context and return it. | ||
This comment has been minimized.
Sorry, something went wrong. |
||
*/ | ||
void popScope(); | ||
QgsExpressionContextScope* popScope(); | ||
This comment has been minimized.
Sorry, something went wrong.
wonder-sk
Member
|
||
|
||
/** Appends a scope to the end of the context. This scope will override | ||
* any matching variables or functions provided by existing scopes within the | ||
|
@@ -491,14 +491,12 @@ class QgsExpressionContextUtils | |
static QgsExpressionContextScope* mapSettingsScope( const QgsMapSettings &mapSettings ) /Factory/; | ||
|
||
/** | ||
* Updates a symbol scope related to a QgsSymbolV2 to an expression context. If there is no existing scope | ||
* provided, a new one will be generated and returned. | ||
* Updates a symbol scope related to a QgsSymbolV2 to an expression context. | ||
* @param symbol symbol to extract properties from | ||
* @param symbolScope optional pointer to an existing scope to update | ||
* @param symbolScope pointer to an existing scope to update | ||
* @note added in QGIS 2.14 | ||
*/ | ||
static QgsExpressionContextScope* updateSymbolScope( const QgsSymbolV2* symbol, QgsExpressionContextScope* symbolScope = nullptr ) /Factory/; | ||
|
||
static QgsExpressionContextScope* updateSymbolScope( const QgsSymbolV2* symbol, QgsExpressionContextScope* symbolScope = nullptr ); | ||
|
||
/** Creates a new scope which contains variables and functions relating to a QgsComposition. | ||
* For instance, number of pages and page sizes. | ||
|
4 comments
on commit 8ad6ca0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m-kuhn thoughts on this? The previously approach was a bit unpredictable, this should make it less so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume that popFoo
deletes foo and takeFoo
transfers ownership to the caller.
And I thought about renaming updateSymbolScope
to just symbolScope
. It would behave like every other fooBarScope
method except for the option to provide an existing scope to update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that not work?
QgsExpressionContextScope* symbolScope( QgsSymbolV2* symbol, QgsExpressionContextScope* scope = nullptr /Transfer/ ) /TransferBack/;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated comment based on 8ad6ca0#commitcomment-15646270
Either do it all in passive voice or nothing ;)