Skip to content

Commit 9e0b9e7

Browse files
committed
Save layer changes on successful repair
when there are topology errors which are fixed subsequently, make sure that the layer can be saved again
1 parent cafa652 commit 9e0b9e7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/app/qgsgeometryvalidationservice.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void QgsGeometryValidationService::onFeatureDeleted( QgsVectorLayer *layer, QgsF
145145

146146
void QgsGeometryValidationService::onBeforeCommitChanges( QgsVectorLayer *layer )
147147
{
148-
if ( !mLayerChecks[layer].topologyChecks.empty() ) // TODO && topologyChecks not fulfilled
148+
if ( !mBypassChecks && !mLayerChecks[layer].topologyChecks.empty() )
149149
{
150150
if ( !layer->allowCommit() )
151151
{
@@ -461,7 +461,9 @@ void QgsGeometryValidationService::triggerTopologyChecks( QgsVectorLayer *layer
461461
}
462462
if ( allErrors.empty() && mLayerChecks[layer].singleFeatureCheckErrors.empty() && mLayerChecks[layer].commitPending )
463463
{
464+
mBypassChecks = true;
464465
layer->commitChanges();
466+
mBypassChecks = false;
465467
mMessageBar->popWidget( mMessageBarItem );
466468
mMessageBarItem = nullptr;
467469
}

src/app/qgsgeometryvalidationservice.h

+4
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ class QgsGeometryValidationService : public QObject
122122
QgsMessageBar *mMessageBar = nullptr;
123123
QgsMessageBarItem *mMessageBarItem = nullptr;
124124

125+
// when checks do complete successfully and changes need to be saved
126+
// this variable is used to indicate that it's safe to bypass the checks
127+
bool mBypassChecks = false;
128+
125129
};
126130

127131
#endif // QGSGEOMETRYVALIDATIONSERVICE_H

0 commit comments

Comments
 (0)