Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[needs-docs] add layerid and layername to atlas expressions
Loading branch information
Showing
2 changed files
with
4 additions
and
0 deletions .
+2
−0
src/core/expression/qgsexpression.cpp
+2
−0
src/core/qgsexpressioncontext.cpp
@@ -638,6 +638,8 @@ void QgsExpression::initVariableHelp()
sVariableHelpTexts .insert ( QStringLiteral ( " layout_dpi" ), QCoreApplication::translate ( " variable_help" , " Composition resolution (DPI)." ) );
// atlas variables
sVariableHelpTexts .insert ( QStringLiteral ( " atlas_layerid" ), QCoreApplication::translate ( " variable_help" , " Current atlas coverage layer ID." ) );
sVariableHelpTexts .insert ( QStringLiteral ( " atlas_layername" ), QCoreApplication::translate ( " variable_help" , " Current atlas coverage layer name." ) );
sVariableHelpTexts .insert ( QStringLiteral ( " atlas_totalfeatures" ), QCoreApplication::translate ( " variable_help" , " Total number of features in atlas." ) );
sVariableHelpTexts .insert ( QStringLiteral ( " atlas_featurenumber" ), QCoreApplication::translate ( " variable_help" , " Current atlas feature number." ) );
sVariableHelpTexts .insert ( QStringLiteral ( " atlas_filename" ), QCoreApplication::translate ( " variable_help" , " Current atlas file name." ) );
@@ -987,6 +987,8 @@ QgsExpressionContextScope *QgsExpressionContextUtils::atlasScope( const QgsAtlas
if ( atlas->enabled () && atlas->coverageLayer () )
{
scope->setFields ( atlas->coverageLayer ()->fields () );
scope->addVariable ( QgsExpressionContextScope::StaticVariable ( QStringLiteral ( " atlas_layerid" ), atlas->coverageLayer ()->id (), true ) );
scope->addVariable ( QgsExpressionContextScope::StaticVariable ( QStringLiteral ( " atlas_layername" ), atlas->coverageLayer ()->name (), true ) );
}
if ( atlas->enabled () )
Toggle all file notes