Skip to content

Commit 2b6b495

Browse files
committed
Only check for validity if attribute has changed
1 parent 4f82b0b commit 2b6b495

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/gui/attributetable/qgsattributetabledelegate.cpp

+12-15
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,22 @@ void QgsAttributeTableDelegate::setModelData( QWidget *editor, QAbstractItemMode
9494
if ( !eww )
9595
return;
9696

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

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

0 commit comments

Comments
 (0)