Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 7b97723
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/app/vertextool/qgsvertextool.cpp
Expand Up @@ -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() );
}
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) )
{
Expand Down

0 comments on commit 7b97723

Please sign in to comment.