Skip to content

Commit 723df76

Browse files
committedOct 18, 2018
display menu at the correct position
1 parent 8839e2f commit 723df76

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎src/app/qgsmaptoolfeatureaction.cpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void QgsMapToolFeatureAction::canvasReleaseEvent( QgsMapMouseEvent *e )
7575
return;
7676
}
7777

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

@@ -89,12 +89,13 @@ void QgsMapToolFeatureAction::deactivate()
8989
QgsMapTool::deactivate();
9090
}
9191

92-
bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y, QPoint pixelpos )
92+
bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y )
9393
{
9494
if ( !layer )
9595
return false;
9696

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

99100
QgsRectangle r;
100101

@@ -151,7 +152,7 @@ bool QgsMapToolFeatureAction::doAction( QgsVectorLayer *layer, int x, int y, QPo
151152
}
152153
} );
153154

154-
featureMenu->exec( pixelpos );
155+
featureMenu->exec( position );
155156
}
156157
return true;
157158
}

‎src/app/qgsmaptoolfeatureaction.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class APP_EXPORT QgsMapToolFeatureAction : public QgsMapTool
5252
void deactivate() override;
5353

5454
private:
55-
bool doAction( QgsVectorLayer *layer, int x, int y, QPoint pixelpos );
55+
bool doAction( QgsVectorLayer *layer, int x, int y );
5656
void doActionForFeature( QgsVectorLayer *layer, QgsFeature feat, QgsPointXY point );
5757
};
5858

0 commit comments

Comments
 (0)
Please sign in to comment.