Skip to content

Commit

Permalink
Merge pull request #9707 from qgis/backport-9695-to-release-3_6
Browse files Browse the repository at this point in the history
[Backport release-3_6] [vertex tool] fixes some editor-tool synchronization issues
  • Loading branch information
3nids authored Apr 4, 2019
2 parents 83dfcc9 + 2f97bb2 commit b7ee7b5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
9 changes: 0 additions & 9 deletions src/app/vertextool/qgslockedfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ QgsLockedFeature::QgsLockedFeature( QgsFeatureId featureId,
// signal changing of current layer
connect( QgisApp::instance()->layerTreeView(), &QgsLayerTreeView::currentLayerChanged, this, &QgsLockedFeature::currentLayerChanged );

// feature was deleted
connect( mLayer, &QgsVectorLayer::featureDeleted, this, &QgsLockedFeature::featureDeleted );

// rolling back
connect( mLayer, &QgsVectorLayer::beforeRollBack, this, &QgsLockedFeature::beforeRollBack );

// geometry was changed
connect( mLayer, &QgsVectorLayer::geometryChanged, this, &QgsLockedFeature::geometryChanged );

replaceVertexMap();
}

Expand Down
17 changes: 15 additions & 2 deletions src/app/vertextool/qgsvertextool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,8 +1304,13 @@ void QgsVertexTool::onCachedGeometryChanged( QgsFeatureId fid, const QgsGeometry
// re-run validation for the feature
validateGeometry( layer, fid );

if ( mVertexEditor && mLockedFeature && mLockedFeature->featureId() == fid && mLockedFeature->layer() == layer )
mVertexEditor->updateEditor( mLockedFeature.get() );
if ( mLockedFeature && mLockedFeature->featureId() == fid && mLockedFeature->layer() == layer )
{
mLockedFeature->geometryChanged( fid, geom );
if ( mVertexEditor )
mVertexEditor->updateEditor( mLockedFeature.get() );
updateLockedFeatureVertices();
}
}

void QgsVertexTool::onCachedGeometryDeleted( QgsFeatureId fid )
Expand All @@ -1318,6 +1323,12 @@ void QgsVertexTool::onCachedGeometryDeleted( QgsFeatureId fid )

// refresh highlighted vertices - some may have been deleted
setHighlightedVertices( mSelectedVertices );

if ( mLockedFeature && mLockedFeature->featureId() == fid && mLockedFeature->layer() == layer )
{
mLockedFeature->featureDeleted( fid );
updateLockedFeatureVertices();
}
}

void QgsVertexTool::updateVertexEditor( QgsVectorLayer *layer, QgsFeatureId fid )
Expand Down Expand Up @@ -1401,6 +1412,7 @@ void QgsVertexTool::cleanupVertexEditor()
{
mLockedFeature.reset();
mVertexEditor.reset();
updateLockedFeatureVertices();
}

void QgsVertexTool::cleanupLockedFeature()
Expand Down Expand Up @@ -2022,6 +2034,7 @@ void QgsVertexTool::moveVertex( const QgsPointXY &mapPoint, const QgsPointLocato
}
}

updateLockedFeatureVertices();
if ( mVertexEditor )
mVertexEditor->updateEditor( mLockedFeature.get() );

Expand Down

0 comments on commit b7ee7b5

Please sign in to comment.