24 : QMouseEvent( event->type(), event->pos(), event->button(), event->buttons(), event->modifiers() )
25 , mHasCachedSnapResult( false )
26 , mOriginalMapPoint( mapCanvas ? mapCanvas->mapSettings().mapToPixel().toMapCoordinates( event->pos() ) :
QgsPointXY() )
27 , mMapPoint( mOriginalMapPoint )
28 , mPixelPoint( event->pos() )
29 , mMapCanvas( mapCanvas )
34 : QMouseEvent( type, pos, button, buttons, modifiers )
35 , mHasCachedSnapResult( false )
36 , mOriginalMapPoint( mapCanvas ? mapCanvas->mapSettings().mapToPixel().toMapCoordinates( pos ) :
QgsPointXY() )
37 , mMapPoint( mOriginalMapPoint )
39 , mMapCanvas( mapCanvas )
46 if ( mHasCachedSnapResult )
49 mHasCachedSnapResult =
true;
52 mSnapMatch = snappingUtils->
snapToMap( mMapPoint,
nullptr,
true );
56 mMapPoint = mSnapMatch.
point();
57 mPixelPoint = mapToPixelCoordinates( mMapPoint );
61 mMapPoint = mOriginalMapPoint;
71 mPixelPoint = mapToPixelCoordinates( point );
98 QPoint QgsMapMouseEvent::mapToPixelCoordinates(
const QgsPointXY &point )
100 double x = point.
x(), y = point.
y();
104 return QPoint( std::round( x ), std::round( y ) );