From c8e4b6830f04cb729f7284db6056dc61e291a8eb Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sat, 12 Oct 2024 11:36:52 +0700 Subject: [PATCH] Improve feature attribute transfer by allowing copying _some_ expression-driven attributes --- src/core/featuremodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/featuremodel.cpp b/src/core/featuremodel.cpp index 71cca1f0d3..2b22e5d925 100644 --- a/src/core/featuremodel.cpp +++ b/src/core/featuremodel.cpp @@ -684,9 +684,10 @@ bool FeatureModel::updateAttributesFromFeature( const QgsFeature &feature ) continue; } - // Do not paste values for attributes that have default values - if ( !mFeature.fields()[idx].defaultValueDefinition().expression().isEmpty() ) + const QgsField field = mFeature.fields()[idx]; + if ( !field.defaultValueDefinition().expression().isEmpty() && !field.defaultValueDefinition().applyOnUpdate() ) { + // Skip attributes that have default value set only once on feature creation to avoid overriding generated UUIDs continue; }