Skip to content

Commit 4c118be

Browse files
committed
Actually apply default value
1 parent 05adea8 commit 4c118be

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/qgsvectorlayer.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -773,14 +773,15 @@ void QgsVectorLayer::updateDefaultValues( QgsFeatureId fid, QgsFeature feature )
773773
if ( !feature.isValid() )
774774
feature = getFeature( fid );
775775

776-
const QgsFields fields = mFields;
777-
int size = fields.size();
776+
int size = mFields.size();
778777
for ( int idx : qgsAsConst( mDefaultValueOnUpdateFields ) )
779778
{
780779
if ( idx < 0 || idx >= size )
781780
continue;
782781

783-
defaultValue( idx, feature );
782+
feature.setAttribute( idx, defaultValue( idx, feature ) );
783+
// TODO catch recursion!!
784+
updateFeature( feature );
784785
}
785786
}
786787
}

0 commit comments

Comments
 (0)