Skip to content
Permalink
Browse files
Offset curve: add empty field values to newly created features
  • Loading branch information
mhugent committed Feb 22, 2012
1 parent c7c840f commit df25981fed0769990ca00bc6b2720326fcc6f809
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/app/qgsmaptooloffsetcurve.cpp
@@ -101,6 +101,16 @@ void QgsMapToolOffsetCurve::canvasReleaseEvent( QMouseEvent * e )
{
QgsFeature f;
f.setGeometry( mModifiedGeometry );

//add empty values for all fields (allows to insert attribute values via the feature form in the same session)
QgsAttributeMap attMap;
const QgsFieldMap& fields = vlayer->pendingFields();
QgsFieldMap::const_iterator fieldIt = fields.constBegin();
for ( ; fieldIt != fields.constEnd(); ++fieldIt )
{
attMap.insert( fieldIt.key(), QVariant() );
}
f.setAttributeMap( attMap );
editOk = vlayer->addFeature( f );
}

0 comments on commit df25981

Please sign in to comment.