Skip to content
Permalink
Browse files

Merge pull request #8620 from m-kuhn/backport-validation-reenable-lay…

…er-savability

Save layer changes on successful repair
  • Loading branch information
m-kuhn committed Dec 6, 2018
2 parents d9d4bd2 + bf0ad45 commit 7f5afe620f10c585231a84752779f0ecf8b3b9e4
Showing with 7 additions and 2 deletions.
  1. +0 −1 src/app/qgisapp.cpp
  2. +3 −1 src/app/qgsgeometryvalidationservice.cpp
  3. +4 −0 src/app/qgsgeometryvalidationservice.h
@@ -7018,7 +7018,6 @@ void QgisApp::commitError( QgsVectorLayer *vlayer )
const QStringList commitErrors = vlayer->commitErrors();
if ( !vlayer->allowCommit() && commitErrors.empty() )
{
QgsMessageLog::logMessage( tr( "Could not save changes. Geometry validation failed." ) );
return;
}

@@ -145,7 +145,7 @@ void QgsGeometryValidationService::onFeatureDeleted( QgsVectorLayer *layer, QgsF

void QgsGeometryValidationService::onBeforeCommitChanges( QgsVectorLayer *layer )
{
if ( !mLayerChecks[layer].topologyChecks.empty() ) // TODO && topologyChecks not fulfilled
if ( !mBypassChecks && !mLayerChecks[layer].topologyChecks.empty() )
{
if ( !layer->allowCommit() )
{
@@ -461,7 +461,9 @@ void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer
}
if ( allErrors.empty() && mLayerChecks[layer].singleFeatureCheckErrors.empty() && mLayerChecks[layer].commitPending )
{
mBypassChecks = true;
layer->commitChanges();
mBypassChecks = false;
mMessageBar->popWidget( mMessageBarItem );
mMessageBarItem = nullptr;
}
@@ -122,6 +122,10 @@ class QgsGeometryValidationService : public QObject
QgsMessageBar *mMessageBar = nullptr;
QgsMessageBarItem *mMessageBarItem = nullptr;

// when checks do complete successfully and changes need to be saved
// this variable is used to indicate that it's safe to bypass the checks
bool mBypassChecks = false;

};

#endif // QGSGEOMETRYVALIDATIONSERVICE_H

0 comments on commit 7f5afe6

Please sign in to comment.
You can’t perform that action at this time.