Connect allowed gaps layer saving to master layer

This commit is contained in:
Matthias Kuhn 2019-08-07 22:18:27 +02:00
parent 66d9e1887f
commit af1916f9f2

View File

@ -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<QgsVectorLayer *>( 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(); } );
}
}
}