Skip to content
Permalink
Browse files

Fix feature fields does not include virtual or joined fields when

feature is requested using a QgsFeatureRequest with FilterFid
  • Loading branch information
nyalldawson authored and rldhont committed May 10, 2016
1 parent c68d7f9 commit d5d76347b7e4129a962c522890c621b53b715aae
Showing with 11 additions and 2 deletions.
  1. +2 −0 src/core/qgsvectorlayerfeatureiterator.cpp
  2. +9 −2 tests/src/python/test_qgsvectorlayer.py
@@ -801,6 +801,8 @@ bool QgsVectorLayerFeatureIterator::nextFeatureFid( QgsFeature& f )
QgsFeatureIterator fi = mSource->mProviderFeatureSource->getFeatures( mProviderRequest );
if ( fi.nextFeature( f ) )
{
f.setFields( mSource->mFields );

if ( mSource->mHasEditBuffer )
updateChangedAttributes( f );

@@ -967,8 +967,15 @@ def test_ExpressionField(self):

idx = layer.addExpressionField('5', QgsField('test', QVariant.LongLong))

self.assertEquals(layer.getFeatures().next()[idx], 5)
self.assertEquals(layer.pendingFields().count(), cnt + 1)
fet = next(layer.getFeatures())
self.assertEqual(fet[idx], 5)
# check fields
self.assertEqual(layer.fields().count(), cnt + 1)
self.assertEqual(fet.fields(), layer.fields())

# retrieve single feature and check fields
fet = next(layer.getFeatures(QgsFeatureRequest().setFilterFid(1)))
self.assertEqual(fet.fields(), layer.fields())

layer.updateExpressionField(idx, '9')

0 comments on commit d5d7634

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