Skip to content
Permalink
Browse files

[vertex tool] do not clear selection of vertices after a move

The list of selected vertices was getting prematurely cleared.

Also had to remove a piece of code to select some vertices of the locked
feature (was causing a crash) but the logic seemed wrong anyway
(and there is a planned work on sync between vertex editor and tool)
  • Loading branch information
wonder-sk authored and nirvn committed Feb 15, 2019
1 parent 64482ae commit 7b97723366fdb04dbade89c795b60739242943a9
Showing with 6 additions and 9 deletions.
  1. +6 −9 src/app/vertextool/qgsvertextool.cpp
@@ -2030,18 +2030,10 @@ void QgsVertexTool::applyEditsToLayers( QgsVertexTool::VertexEdits &edits )
for ( ; it2 != layerEdits.end(); ++it2 )
{
layer->changeGeometry( it2.key(), it2.value() );
for ( int i = 0; i < mSelectedVertices.length(); ++i )
{
if ( mSelectedVertices.at( i ).layer == layer && mSelectedVertices.at( i ).fid == it2.key() )
{
mSelectedFeature->selectVertex( mSelectedVertices.at( i ).vertexId );
}
}
}
layer->endEditCommand();
layer->triggerRepaint();


if ( mVertexEditor )
mVertexEditor->updateEditor( mSelectedFeature.get() );
}
@@ -2209,6 +2201,11 @@ void QgsVertexTool::deleteVertex()

void QgsVertexTool::setHighlightedVertices( const QList<Vertex> &listVertices, HighlightMode mode )
{
// we need to make a local copy of vertices - often this method gets called
// just to refresh positions and so mSelectedVertices is passed. But then in reset mode
// we clear that array, which could clear also listVertices.
QList<Vertex> listVerticesLocal( listVertices );

if ( mode == ModeReset )
{
qDeleteAll( mSelectedVerticesMarkers );
@@ -2241,7 +2238,7 @@ void QgsVertexTool::setHighlightedVertices( const QList<Vertex> &listVertices, H
return true;
};

for ( const Vertex &vertex : listVertices )
for ( const Vertex &vertex : listVerticesLocal )
{
if ( mode == ModeAdd && mSelectedVertices.contains( vertex ) )
{

0 comments on commit 7b97723

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