Skip to content

Commit 7b97723

Browse files
wonder-sknirvn
authored andcommitted
[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)
1 parent 64482ae commit 7b97723

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/app/vertextool/qgsvertextool.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,18 +2030,10 @@ void QgsVertexTool::applyEditsToLayers( QgsVertexTool::VertexEdits &edits )
20302030
for ( ; it2 != layerEdits.end(); ++it2 )
20312031
{
20322032
layer->changeGeometry( it2.key(), it2.value() );
2033-
for ( int i = 0; i < mSelectedVertices.length(); ++i )
2034-
{
2035-
if ( mSelectedVertices.at( i ).layer == layer && mSelectedVertices.at( i ).fid == it2.key() )
2036-
{
2037-
mSelectedFeature->selectVertex( mSelectedVertices.at( i ).vertexId );
2038-
}
2039-
}
20402033
}
20412034
layer->endEditCommand();
20422035
layer->triggerRepaint();
20432036

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

22102202
void QgsVertexTool::setHighlightedVertices( const QList<Vertex> &listVertices, HighlightMode mode )
22112203
{
2204+
// we need to make a local copy of vertices - often this method gets called
2205+
// just to refresh positions and so mSelectedVertices is passed. But then in reset mode
2206+
// we clear that array, which could clear also listVertices.
2207+
QList<Vertex> listVerticesLocal( listVertices );
2208+
22122209
if ( mode == ModeReset )
22132210
{
22142211
qDeleteAll( mSelectedVerticesMarkers );
@@ -2241,7 +2238,7 @@ void QgsVertexTool::setHighlightedVertices( const QList<Vertex> &listVertices, H
22412238
return true;
22422239
};
22432240

2244-
for ( const Vertex &vertex : listVertices )
2241+
for ( const Vertex &vertex : listVerticesLocal )
22452242
{
22462243
if ( mode == ModeAdd && mSelectedVertices.contains( vertex ) )
22472244
{

0 commit comments

Comments
 (0)