Skip to content

Commit

Permalink
[Geometry checker] Enter update mode when editing result layers
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Oct 23, 2017
1 parent bd8028e commit 156f006
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 12 additions & 0 deletions src/plugins/geometry_checker/qgsgeometrychecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ QgsGeometryChecker::QgsGeometryChecker( const QList<QgsGeometryCheck *> &checks,
{
connect( mContext->featurePools[layerId], SIGNAL( featureIdsChanged( QString, QMap<QgsFeatureId, QgsFeatureId> ) ), this, SLOT( updateFeatureIds( QString, QMap<QgsFeatureId, QgsFeatureId> ) ) );
}
for ( const QgsFeaturePool *featurePool : mContext->featurePools.values() )
{
if ( featurePool->getLayer() )
{
featurePool->getLayer()->setReadOnly( true );
// Enter update mode to defer ogr dataset repacking until the checker has finished
featurePool->getLayer()->dataProvider()->enterUpdateMode();
}
}
}

QgsGeometryChecker::~QgsGeometryChecker()
Expand All @@ -42,7 +51,10 @@ QgsGeometryChecker::~QgsGeometryChecker()
for ( const QgsFeaturePool *featurePool : mContext->featurePools.values() )
{
if ( featurePool->getLayer() )
{
featurePool->getLayer()->dataProvider()->leaveUpdateMode();
featurePool->getLayer()->setReadOnly( false );
}
delete featurePool;
}
delete mContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,6 @@ void QgsGeometryCheckerSetupTab::runChecks()

emit checkerStarted( checker );

// Add result layer (do this after checkerStarted, otherwise warning about removing of result layer may appear)
for ( QgsVectorLayer *layer : processLayers )
{
layer->setReadOnly( true );
}
if ( ui.radioButtonOutputNew->isChecked() )
{
QList<QgsMapLayer *> addLayers;
Expand Down

0 comments on commit 156f006

Please sign in to comment.