Skip to content
Permalink
Browse files

[node editor] Improve UX by having right-click bind feature to node e…

…ditor (i.e., bye bye menu)
  • Loading branch information
nirvn committed Jan 23, 2019
1 parent 2defe21 commit 8bd997d0a1c48090c36cd81e78717c3f16aa5858
Showing with 17 additions and 6 deletions.
  1. +4 −1 src/app/vertextool/qgsvertexeditor.cpp
  2. +13 −5 src/app/vertextool/qgsvertextool.cpp
@@ -333,7 +333,10 @@ QgsVertexEditor::QgsVertexEditor(

void QgsVertexEditor::updateEditor( QgsVectorLayer *layer, QgsSelectedFeature *selectedFeature )
{
delete mVertexModel;
if ( mSelectedFeature )
{
delete mVertexModel;
}

mLayer = layer;
mSelectedFeature = selectedFeature;
@@ -286,7 +286,7 @@ void QgsVertexTool::activate()
{
if ( QgisApp::instance() )
{
showVertexEditor();
showVertexEditor(); //#spellok
}
QgsMapToolAdvancedDigitizing::activate();
}
@@ -445,10 +445,7 @@ void QgsVertexTool::cadCanvasPressEvent( QgsMapMouseEvent *e )
// show popup menu - if we are on top of a feature
if ( mLastMouseMoveMatch.isValid() && mLastMouseMoveMatch.layer() )
{
QMenu menu;
QAction *actionVertexEditor = menu.addAction( tr( "Vertex Editor" ) );
connect( actionVertexEditor, &QAction::triggered, this, &QgsVertexTool::showVertexEditor ); //#spellok
menu.exec( mCanvas->mapToGlobal( e->pos() ) );
showVertexEditor(); //#spellok
}
}
}
@@ -1058,6 +1055,17 @@ void QgsVertexTool::showVertexEditor() //#spellok
QgsPointLocator::Match m = mLastMouseMoveMatch;
if ( m.isValid() || m.layer() )
{
if ( mSelectedFeature && mSelectedFeature->featureId() == m.featureId() && mSelectedFeature->layer() == m.layer() )
{
// if show feature is called on a feature that's already binded to the vertex editor, toggle it off
mSelectedFeature.reset();
if ( mVertexEditor )
{
mVertexEditor->updateEditor( nullptr, nullptr );
}
return;
}

mSelectedFeature.reset( new QgsSelectedFeature( m.featureId(), m.layer(), mCanvas ) );
for ( int i = 0; i < mSelectedVertices.length(); ++i )
{

0 comments on commit 8bd997d

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