mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Add project/layer expression context scope only if it is available
Better to leave them out than adding dummy scopes
This commit is contained in:
parent
63d1cfddc8
commit
062de6aeff
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user