Skip to content
Permalink
Browse files

Cleanups

  • Loading branch information
nyalldawson committed Aug 22, 2015
1 parent 43bcc0c commit 89a362c44826b6f3ad3a085291d21f69d652ca50
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/core/qgsexpressioncontext.cpp
@@ -545,7 +545,7 @@ QgsExpressionContextScope* QgsExpressionContextUtils::layerScope( QgsMapLayer* l
QString typeString( QGis::vectorGeometryType( vLayer->geometryType() ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "layer_geometrytype", typeString, true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "layer_featurecount", QVariant::fromValue( vLayer->featureCount() ), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "_fields_", QVariant::fromValue( vLayer->fields() ), true ) );
scope->setFields( vLayer->fields() );
}

//TODO - add functions. Possibilities include:
@@ -754,8 +754,8 @@ void QgsExpressionContextUtils::setComposerItemVariables( QgsComposerItem* compo
QgsExpressionContext QgsExpressionContextUtils::createFeatureBasedContext( const QgsFeature &feature, const QgsFields &fields )
{
QgsExpressionContextScope* scope = new QgsExpressionContextScope();
scope->setVariable( QString( "_feature_" ), QVariant::fromValue( feature ) );
scope->setVariable( QString( "_fields_" ), QVariant::fromValue( fields ) );
scope->setFeature( feature );
scope->setFields( fields );
return QgsExpressionContext() << scope;
}

0 comments on commit 89a362c

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