Skip to content
Permalink
Browse files

Evaluate defaults when adding new features in transaction group

Fixes #37222
  • Loading branch information
elpaso authored and nyalldawson committed Jun 16, 2020
1 parent 4dc9b38 commit 2e6fdbe61504c7dd79b84ed6bca5d5150b81796f
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/app/qgsfeatureaction.cpp
@@ -249,6 +249,18 @@ bool QgsFeatureAction::addFeature( const QgsAttributeMap &defaultAttributes, boo
}
else
{
// If the layer is inside a transaction group we need to add
// the feature first to get the provider-evaluated defaults
const bool inTransaction { mLayer->dataProvider() &&
mLayer->dataProvider()->transaction() };
if ( inTransaction )
{
if ( mLayer->addFeature( *mFeature ) )
{
mLayer->deleteFeature( mFeature->id() );
}
}

QgsAttributeDialog *dialog = newDialog( false );
// delete the dialog when it is closed
dialog->setAttribute( Qt::WA_DeleteOnClose );

0 comments on commit 2e6fdbe

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