Skip to content
Permalink
Browse files

attribute form: allow overwriting invalid source attribute values and…

… skip empty edit commands (fixes #10360)
  • Loading branch information
jef-n committed Jun 13, 2014
1 parent 406fab2 commit 74a750314c744a44eacb5f7593c18a17b0f38ac5
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/gui/qgsattributeform.cpp
@@ -188,15 +188,24 @@ bool QgsAttributeForm::save()
{
mLayer->beginEditCommand( mEditCommandMessage );

int n = 0;
for ( int i = 0; i < dst.count(); ++i )
{
if ( dst[i] == src[i] || !src[i].isValid() )
if ( dst[i] == src[i] || !dst[i].isValid() )
{
QgsDebugMsg( "equal or invalid destination" );
QgsDebugMsg( QString( "dst:'%1' (type:%2,isNull:%3,isValid:%4)" )
.arg( dst[i].toString() ).arg( dst[i].typeName() ).arg( dst[i].isNull() ).arg( dst[i].isValid() ) );
QgsDebugMsg( QString( "src:'%1' (type:%2,isNull:%3,isValid:%4)" )
.arg( src[i].toString() ).arg( src[i].typeName() ).arg( src[i].isNull() ).arg( src[i].isValid() ) );
continue;
}

success &= mLayer->changeAttributeValue( mFeature.id(), i, dst[i], src[i] );
n++;
}

if ( success )
if ( success && n > 0 )
{
mLayer->endEditCommand();
mFeature.setAttributes( dst );

0 comments on commit 74a7503

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