Skip to content

Commit b90dba4

Browse files
committedSep 22, 2014
Attribute form: do not try to edit non-editable fields
1 parent e613c8b commit b90dba4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/gui/qgsattributeform.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ bool QgsAttributeForm::save()
164164
QVariant srcVar = eww->value();
165165
// need to check dstVar.isNull() != srcVar.isNull()
166166
// otherwise if dstVar=NULL and scrVar=0, then dstVar = srcVar
167-
if (( dstVar != srcVar || dstVar.isNull() != srcVar.isNull() ) && srcVar.isValid() )
167+
if (( dstVar != srcVar || dstVar.isNull() != srcVar.isNull() ) && srcVar.isValid() && mLayer->fieldEditable( eww->fieldIdx() ) )
168168
{
169169
dst[eww->fieldIdx()] = srcVar;
170170

@@ -205,7 +205,9 @@ bool QgsAttributeForm::save()
205205
int n = 0;
206206
for ( int i = 0; i < dst.count(); ++i )
207207
{
208-
if (( dst[i] == src[i] && dst[i].isNull() == src[i].isNull() ) || !dst[i].isValid() )
208+
if (( dst[i] == src[i] && dst[i].isNull() == src[i].isNull() ) // If field is not changed...
209+
|| !dst[i].isValid() // or the widget returns invalid (== do not change)
210+
|| !mLayer->fieldEditable( i ) ) // or the field cannot be edited ...
209211
{
210212
continue;
211213
}

0 commit comments

Comments
 (0)
Please sign in to comment.