Skip to content

Commit 9da5fd3

Browse files
committed
Always save newly created features, even if no attributes are
modified in the form popup after feature creation Fixes #18056
1 parent fcb50a6 commit 9da5fd3

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/gui/qgsattributeform.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,26 @@ bool QgsAttributeForm::saveMultiEdits()
572572

573573
bool QgsAttributeForm::save()
574574
{
575-
if ( mIsSaving || !mDirty )
575+
if ( mIsSaving )
576576
return true;
577577

578+
// only do the dirty checks when editing an existing feature - for new
579+
// features we need to add them even if the attributes are unchanged from the initial
580+
// default values
581+
switch ( mMode )
582+
{
583+
case SingleEditMode:
584+
case MultiEditMode:
585+
if ( !mDirty )
586+
return true;
587+
break;
588+
589+
case AddFeatureMode:
590+
case SearchMode:
591+
case AggregateSearchMode:
592+
break;
593+
}
594+
578595
mIsSaving = true;
579596

580597
bool success = true;

0 commit comments

Comments
 (0)