Skip to content

Commit 5134791

Browse files
committed
Only check for validity if attribute has changed
1 parent 1eaf03d commit 5134791

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/gui/attributetable/qgsattributetabledelegate.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,25 +93,22 @@ void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemMode
9393
if ( !eww )
9494
return;
9595

96-
// This fixes https://issues.qgis.org/issues/16492
97-
QgsFeatureRequest request( fid );
98-
request.setFlags( QgsFeatureRequest::NoGeometry );
99-
request.setSubsetOfAttributes( QgsAttributeList( ) );
100-
QgsFeature feature;
101-
vl->getFeatures( request ).nextFeature( feature );
102-
if ( ! feature.isValid( ) )
103-
{
104-
// Model is out of sync (again!).
105-
return;
106-
}
107-
10896
newValue = eww->value();
10997

11098
if ( ( oldValue != newValue && newValue.isValid() ) || oldValue.isNull() != newValue.isNull() )
11199
{
112-
vl->beginEditCommand( tr( "Attribute changed" ) );
113-
vl->changeAttributeValue( fid, fieldIdx, newValue, oldValue );
114-
vl->endEditCommand();
100+
// This fixes https://issues.qgis.org/issues/16492
101+
QgsFeatureRequest request( fid );
102+
request.setFlags( QgsFeatureRequest::NoGeometry );
103+
request.setSubsetOfAttributes( QgsAttributeList( ) );
104+
QgsFeature feature;
105+
vl->getFeatures( request ).nextFeature( feature );
106+
if ( feature.isValid( ) )
107+
{
108+
vl->beginEditCommand( tr( "Attribute changed" ) );
109+
vl->changeAttributeValue( fid, fieldIdx, newValue, oldValue );
110+
vl->endEditCommand();
111+
}
115112
}
116113
}
117114

0 commit comments

Comments
 (0)