@@ -286,7 +286,7 @@ void QgsVertexTool::activate()
286
286
{
287
287
if ( QgisApp::instance () )
288
288
{
289
- showVertexEditor ();
289
+ showVertexEditor (); // #spellok
290
290
}
291
291
QgsMapToolAdvancedDigitizing::activate ();
292
292
}
@@ -445,10 +445,7 @@ void QgsVertexTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
445
445
// show popup menu - if we are on top of a feature
446
446
if ( mLastMouseMoveMatch .isValid () && mLastMouseMoveMatch .layer () )
447
447
{
448
- QMenu menu;
449
- QAction *actionVertexEditor = menu.addAction ( tr ( " Vertex Editor" ) );
450
- connect ( actionVertexEditor, &QAction::triggered, this , &QgsVertexTool::showVertexEditor ); // #spellok
451
- menu.exec ( mCanvas ->mapToGlobal ( e->pos () ) );
448
+ showVertexEditor (); // #spellok
452
449
}
453
450
}
454
451
}
@@ -1058,6 +1055,17 @@ void QgsVertexTool::showVertexEditor() //#spellok
1058
1055
QgsPointLocator::Match m = mLastMouseMoveMatch ;
1059
1056
if ( m.isValid () || m.layer () )
1060
1057
{
1058
+ if ( mSelectedFeature && mSelectedFeature ->featureId () == m.featureId () && mSelectedFeature ->layer () == m.layer () )
1059
+ {
1060
+ // if show feature is called on a feature that's already binded to the vertex editor, toggle it off
1061
+ mSelectedFeature .reset ();
1062
+ if ( mVertexEditor )
1063
+ {
1064
+ mVertexEditor ->updateEditor ( nullptr , nullptr );
1065
+ }
1066
+ return ;
1067
+ }
1068
+
1061
1069
mSelectedFeature .reset ( new QgsSelectedFeature ( m.featureId (), m.layer (), mCanvas ) );
1062
1070
for ( int i = 0 ; i < mSelectedVertices .length (); ++i )
1063
1071
{
0 commit comments