@@ -139,6 +139,9 @@ void QgsGeometryValidationService::onBeforeCommitChanges( QgsVectorLayer *layer
139
139
{
140
140
emit warning ( tr ( " Can not save yet, we'll need to run some topology checks on your dataset first..." ) );
141
141
}
142
+
143
+ mLayerChecks [layer].commitPending = true ;
144
+
142
145
triggerTopologyChecks ( layer );
143
146
}
144
147
}
@@ -193,7 +196,7 @@ void QgsGeometryValidationService::enableLayerChecks( QgsVectorLayer *layer )
193
196
precision = 8 ;
194
197
}
195
198
196
- checkInformation.context = qgis::make_unique<QgsGeometryCheckContext>( precision , mProject ->crs (), mProject ->transformContext () );
199
+ checkInformation.context = qgis::make_unique<QgsGeometryCheckContext>( 10 , mProject ->crs (), mProject ->transformContext () );
197
200
198
201
QList<QgsGeometryCheck *> layerChecks;
199
202
@@ -311,6 +314,7 @@ void QgsGeometryValidationService::processFeature( QgsVectorLayer *layer, QgsFea
311
314
QgsFeature feature = layer->getFeature ( fid );
312
315
313
316
const auto &checks = mLayerChecks [layer].singleFeatureChecks ;
317
+ mLayerChecks [layer].singleFeatureCheckErrors .remove ( fid );
314
318
315
319
// The errors are going to be sent out via a signal. We cannot keep ownership in here (or can we?)
316
320
// nor can we be sure that a single slot is connected to the signal. So make it a shared_ptr.
@@ -323,6 +327,9 @@ void QgsGeometryValidationService::processFeature( QgsVectorLayer *layer, QgsFea
323
327
allErrors.append ( std::shared_ptr<QgsSingleGeometryCheckError>( error ) );
324
328
}
325
329
330
+ if ( !allErrors.empty () )
331
+ mLayerChecks [layer].singleFeatureCheckErrors .insert ( fid, allErrors );
332
+
326
333
emit geometryCheckCompleted ( layer, fid, allErrors );
327
334
}
328
335
@@ -408,6 +415,10 @@ void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer
408
415
futureWatcher->deleteLater ();
409
416
if ( mLayerChecks [layer].topologyCheckFutureWatcher == futureWatcher )
410
417
mLayerChecks [layer].topologyCheckFutureWatcher = nullptr ;
418
+
419
+ if ( allErrors.empty () && !mLayerChecks [layer].singleFeatureCheckErrors .empty () && mLayerChecks [layer].commitPending )
420
+ layer->commitChanges ();
421
+ mLayerChecks [layer].commitPending = false ;
411
422
} );
412
423
413
424
mLayerChecks [layer].topologyCheckFutureWatcher = futureWatcher;
0 commit comments