Skip to content

Commit

Permalink
[layout] Add item's position and dimension to context
Browse files Browse the repository at this point in the history
  • Loading branch information
agiudiceandrea authored Sep 28, 2024
1 parent 2ef3cde commit 12f4f7c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/expression/qgsexpressioncontextutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,10 @@ QgsExpressionContextScope *QgsExpressionContextUtils::layoutItemScope( const Qgs
//add known layout item context variables
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "item_id" ), item->id(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "item_uuid" ), item->uuid(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "item_left" ), item->pagePos().x(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "item_top" ), item->pagePos().y(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "item_width" ), item->rectWithFrame().width(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "item_height" ), item->rectWithFrame().height(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "layout_page" ), item->page() + 1, true ) );

if ( item->layout() )
Expand Down

0 comments on commit 12f4f7c

Please sign in to comment.