From af1916f9f25b9f57bc9d7e3b321d7db871b363bc Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Wed, 7 Aug 2019 22:18:27 +0200 Subject: [PATCH] Connect allowed gaps layer saving to master layer --- src/app/qgsgeometryvalidationservice.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/qgsgeometryvalidationservice.cpp b/src/app/qgsgeometryvalidationservice.cpp index cf3fe841878..3caf0e376e0 100644 --- a/src/app/qgsgeometryvalidationservice.cpp +++ b/src/app/qgsgeometryvalidationservice.cpp @@ -269,6 +269,14 @@ void QgsGeometryValidationService::enableLayerChecks( QgsVectorLayer *layer ) { const QVariantMap checkConfiguration = layer->geometryOptions()->checkConfiguration( checkId ); topologyChecks.append( factory->createGeometryCheck( checkInformation.context.get(), checkConfiguration ) ); + + if ( checkConfiguration.value( QStringLiteral( "allowedGapsEnabled" ) ).toBool() ) + { + QgsVectorLayer *gapsLayer = QgsProject::instance()->mapLayer( checkConfiguration.value( "allowedGapsLayer" ).toString() ); + connect( layer, &QgsVectorLayer::editingStarted, gapsLayer, [gapsLayer] { gapsLayer->startEditing(); } ); + connect( layer, &QgsVectorLayer::beforeRollBack, gapsLayer, [gapsLayer] { gapsLayer->rollBack(); } ); + connect( layer, &QgsVectorLayer::editingStopped, gapsLayer, [gapsLayer] { gapsLayer->commitChanges(); } ); + } } }