Skip to content

Commit

Permalink
Mark some inbuilt expression variables with missing read-only flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 26, 2016
1 parent 3744ac2 commit 7b01b41
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/qgsexpressioncontext.cpp
Expand Up @@ -429,7 +429,8 @@ void QgsExpressionContext::setOriginalValueVariable( const QVariant &value )
if ( mStack.isEmpty() )
mStack.append( new QgsExpressionContextScope() );

mStack.last()->setVariable( QgsExpressionContext::EXPR_ORIGINAL_VALUE, value );
mStack.last()->addVariable( QgsExpressionContextScope::StaticVariable( QgsExpressionContext::EXPR_ORIGINAL_VALUE,
value, true ) );
}


Expand Down Expand Up @@ -711,8 +712,8 @@ QgsExpressionContextScope* QgsExpressionContextUtils::mapSettingsScope( const Qg
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_id", "canvas", true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_rotation", mapSettings.rotation(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_scale", mapSettings.scale(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", mapSettings.extent().width() ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", mapSettings.extent().height() ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", mapSettings.extent().width(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", mapSettings.extent().height(), true ) );
QgsGeometry* centerPoint = QgsGeometry::fromPoint( mapSettings.visibleExtent().center() );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_center", QVariant::fromValue( *centerPoint ), true ) );
delete centerPoint;
Expand Down

0 comments on commit 7b01b41

Please sign in to comment.