Skip to content

Commit 7b01b41

Browse files
committed
Mark some inbuilt expression variables with missing read-only flag
1 parent 3744ac2 commit 7b01b41

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/qgsexpressioncontext.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,8 @@ void QgsExpressionContext::setOriginalValueVariable( const QVariant &value )
429429
if ( mStack.isEmpty() )
430430
mStack.append( new QgsExpressionContextScope() );
431431

432-
mStack.last()->setVariable( QgsExpressionContext::EXPR_ORIGINAL_VALUE, value );
432+
mStack.last()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_ORIGINAL_VALUE,
433+
value, true ) );
433434
}
434435

435436

@@ -711,8 +712,8 @@ QgsExpressionContextScope* QgsExpressionContextUtils::mapSettingsScope( const Qg
711712
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_id", "canvas", true ) );
712713
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_rotation", mapSettings.rotation(), true ) );
713714
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_scale", mapSettings.scale(), true ) );
714-
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", mapSettings.extent().width() ) );
715-
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", mapSettings.extent().height() ) );
715+
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", mapSettings.extent().width(), true ) );
716+
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", mapSettings.extent().height(), true ) );
716717
QgsGeometry* centerPoint = QgsGeometry::fromPoint( mapSettings.visibleExtent().center() );
717718
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_center", QVariant::fromValue( *centerPoint ), true ) );
718719
delete centerPoint;

0 commit comments

Comments
 (0)