File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ bool QgsAttributeForm::save()
164
164
QVariant srcVar = eww->value ();
165
165
// need to check dstVar.isNull() != srcVar.isNull()
166
166
// 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 () ) )
168
168
{
169
169
dst[eww->fieldIdx ()] = srcVar;
170
170
@@ -205,7 +205,9 @@ bool QgsAttributeForm::save()
205
205
int n = 0 ;
206
206
for ( int i = 0 ; i < dst.count (); ++i )
207
207
{
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 ...
209
211
{
210
212
continue ;
211
213
}
You can’t perform that action at this time.
0 commit comments