Cache field lookup when evaluating field-based property values

This commit is contained in:
Nyall Dawson 2017-11-27 07:55:05 +10:00
parent d1a71f0971
commit c5f65359d8

View File

@ -448,14 +448,13 @@ QVariant QgsProperty::propertyValue( const QgsExpressionContext &context, const
*ok = true;
return f.attribute( d->cachedFieldIdx );
}
int fieldIdx = f.fieldNameIndex( d->fieldName );
if ( fieldIdx < 0 )
prepare( context );
if ( d->cachedFieldIdx < 0 )
return defaultValue;
if ( ok )
*ok = true;
return f.attribute( fieldIdx );
return f.attribute( d->cachedFieldIdx );
}
case ExpressionBasedProperty: