Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
QMouseEvent::pos is no more
  • Loading branch information
nyalldawson committed Jul 27, 2021
1 parent 5b80469 commit 5fc5a0b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/gui/layout/qgslayoutviewtoolmoveitemcontent.cpp
Expand Up @@ -94,7 +94,7 @@ void QgsLayoutViewToolMoveItemContent::wheelEvent( QWheelEvent *event )
{
event->accept();

QPointF scenePoint = view()->mapToScene( event->pos() );
QPointF scenePoint = view()->mapToScene( event->position().x(), event->position().y() );
//select topmost item at position of event
QgsLayoutItem *item = layout()->layoutItemAt( scenePoint, true );
if ( !item || !item->isSelected() )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/models/qgsmodelgraphicsview.cpp
Expand Up @@ -147,7 +147,7 @@ void QgsModelGraphicsView::wheelZoom( QWheelEvent *event )
QgsRectangle visibleRect = QgsRectangle( mapToScene( viewportRect ).boundingRect() );

//transform the mouse pos to scene coordinates
QPointF scenePoint = mapToScene( event->pos() );
QPointF scenePoint = mapToScene( event->position().x(), event->position().y() );

//adjust view center
QgsPointXY oldCenter( visibleRect.center() );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.cpp
Expand Up @@ -2118,7 +2118,7 @@ void QgsMapCanvas::wheelEvent( QWheelEvent *e )

// zoom map to mouse cursor by scaling
QgsPointXY oldCenter = center();
QgsPointXY mousePos( getCoordinateTransform()->toMapCoordinates( e->x(), e->y() ) );
QgsPointXY mousePos( getCoordinateTransform()->toMapCoordinates( e->position().x(), e->position().y() ) );
QgsPointXY newCenter( mousePos.x() + ( ( oldCenter.x() - mousePos.x() ) * signedWheelFactor ),
mousePos.y() + ( ( oldCenter.y() - mousePos.y() ) * signedWheelFactor ) );

Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmapoverviewcanvas.cpp
Expand Up @@ -161,9 +161,9 @@ void QgsMapOverviewCanvas::wheelEvent( QWheelEvent *e )
double signedWheelFactor = e->angleDelta().y() > 0 ? 1 / zoomFactor : zoomFactor;

const QgsMapToPixel &cXf = mSettings.mapToPixel();
QgsPointXY center = cXf.toMapCoordinates( e->pos() );
QgsPointXY center = cXf.toMapCoordinates( e->position().x(), e->position().y() );

updatePanningWidget( e->pos() );
updatePanningWidget( QPoint( e->position().x(), e->position().y() ) );
mMapCanvas->zoomByFactor( signedWheelFactor, &center );
}

Expand Down

0 comments on commit 5fc5a0b

Please sign in to comment.