display menu at the correct position

This commit is contained in:
signedav 2018-10-18 14:54:53 +02:00
parent 8839e2fc0c
commit 723df76fba
2 changed files with 5 additions and 4 deletions

View File

@ -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." ) );
}
@ -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;
@ -151,7 +152,7 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y, QPo
}
} );
featureMenu->exec( pixelpos );
featureMenu->exec( position );
}
return true;
}

View File

@ -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 );
};