Skip to content
Permalink
Browse files

Add project/layer expression context scope only if it is available

Better to leave them out than adding dummy scopes
  • Loading branch information
wonder-sk committed Jan 6, 2017
1 parent 63d1cfd commit 062de6aeffd1f712bd4a8b94a9df469ea9038290
Showing with 10 additions and 4 deletions.
  1. +8 −3 src/core/qgsexpressioncontext.cpp
  2. +2 −1 src/gui/symbology-ng/qgssymbolwidgetcontext.cpp
@@ -686,9 +686,14 @@ QgsExpressionContextScope* QgsExpressionContextUtils::layerScope( const QgsMapLa
QList<QgsExpressionContextScope*> QgsExpressionContextUtils::globalProjectLayerScopes( const QgsMapLayer* layer )
{
QList<QgsExpressionContextScope*> scopes;
scopes << globalScope()
<< projectScope( QgsProject::instance() ) // TODO: use project associated with layer
<< layerScope( layer );
scopes << globalScope();

QgsProject* project = QgsProject::instance(); // TODO: use project associated with layer
if ( project )
scopes << projectScope( project );

if ( layer )
scopes << layerScope( layer );
return scopes;
}

@@ -93,6 +93,7 @@ QList<QgsExpressionContextScope *> QgsSymbolWidgetContext::globalProjectAtlasMap
{
scopes << QgsExpressionContextUtils::mapSettingsScope( QgsMapSettings() );
}
scopes << QgsExpressionContextUtils::layerScope( layer );
if ( layer )
scopes << QgsExpressionContextUtils::layerScope( layer );
return scopes;
}

0 comments on commit 062de6a

Please sign in to comment.
You can’t perform that action at this time.