Skip to content

Commit

Permalink
Offset curve: add empty field values to newly created features
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Feb 22, 2012
1 parent c7c840f commit df25981
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/qgsmaptooloffsetcurve.cpp
Expand Up @@ -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 );
}

Expand Down

0 comments on commit df25981

Please sign in to comment.