Skip to content
Permalink
Browse files

More gui expression porting

  • Loading branch information
nyalldawson committed Aug 22, 2015
1 parent 786de4b commit 000a62f33cc13b04167779ba7fc0f21978ef7b86
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/app/qgsdiagramproperties.cpp
@@ -526,14 +526,20 @@ void QgsDiagramProperties::on_mFindMaximumValueButton_clicked()
if ( isExpression )
{
QgsExpression exp( sizeFieldNameOrExp );
exp.prepare( mLayer->fields() );
QgsExpressionContext context;
context << QgsExpressionContextUtils::globalScope()
<< QgsExpressionContextUtils::projectScope()
<< QgsExpressionContextUtils::layerScope( mLayer );

exp.prepare( &context );
if ( !exp.hasEvalError() )
{
QgsFeature feature;
QgsFeatureIterator features = mLayer->getFeatures();
while ( features.nextFeature( *&feature ) )
{
maxValue = qMax( maxValue, exp.evaluate( &feature ).toFloat() );
context.setFeature( feature );
maxValue = qMax( maxValue, exp.evaluate( &context ).toFloat() );
}
}
else

0 comments on commit 000a62f

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