Skip to content

Commit

Permalink
display menu at the correct position
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Oct 18, 2018
1 parent 8839e2f commit 723df76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/app/qgsmaptoolfeatureaction.cpp
Expand Up @@ -75,7 +75,7 @@ void QgsMapToolFeatureAction::canvasReleaseEvent( QgsMapMouseEvent *e )
return;
}

if ( !doAction( vlayer, e->x(), e->y(), e->originalPixelPoint() ) )
if ( !doAction( vlayer, e->x(), e->y() ) )
QgisApp::instance()->statusBarIface()->showMessage( tr( "No features at this position found." ) );
}

Expand All @@ -89,12 +89,13 @@ void QgsMapToolFeatureAction::deactivate()
QgsMapTool::deactivate();
}

bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y, QPoint pixelpos )
bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y )
{
if ( !layer )
return false;

QgsPointXY point = mCanvas->getCoordinateTransform()->toMapCoordinates( x, y );
QPoint position = mCanvas->mapToGlobal( QPoint( x + 5, y + 5 ) );

QgsRectangle r;

Expand Down Expand Up @@ -151,7 +152,7 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y, QPo
}
} );

featureMenu->exec( pixelpos );
featureMenu->exec( position );
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolfeatureaction.h
Expand Up @@ -52,7 +52,7 @@ class APP_EXPORT QgsMapToolFeatureAction : public QgsMapTool
void deactivate() override;

private:
bool doAction( QgsVectorLayer *layer, int x, int y, QPoint pixelpos );
bool doAction( QgsVectorLayer *layer, int x, int y );
void doActionForFeature( QgsVectorLayer *layer, QgsFeature feat, QgsPointXY point );
};

Expand Down

0 comments on commit 723df76

Please sign in to comment.