Skip to content

Commit c5f6535

Browse files
committed
Cache field lookup when evaluating field-based property values
1 parent d1a71f0 commit c5f6535

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/core/qgsproperty.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,13 @@ QVariant QgsProperty::propertyValue( const QgsExpressionContext &context, const
448448
*ok = true;
449449
return f.attribute( d->cachedFieldIdx );
450450
}
451-
452-
int fieldIdx = f.fieldNameIndex( d->fieldName );
453-
if ( fieldIdx < 0 )
451+
prepare( context );
452+
if ( d->cachedFieldIdx < 0 )
454453
return defaultValue;
455454

456455
if ( ok )
457456
*ok = true;
458-
return f.attribute( fieldIdx );
457+
return f.attribute( d->cachedFieldIdx );
459458
}
460459

461460
case ExpressionBasedProperty:

0 commit comments

Comments
 (0)