Skip to content
Permalink
Browse files

Mark some inbuilt expression variables with missing read-only flag

  • Loading branch information
nyalldawson committed Jan 26, 2016
1 parent 3744ac2 commit 7b01b414fd6978bd53ac7a52c63f044ab83bb0ae
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/core/qgsexpressioncontext.cpp
@@ -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 ) );
}


@@ -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;

0 comments on commit 7b01b41

Please sign in to comment.
You can’t perform that action at this time.