From f3d75146f70ca0803c2374ca97a81c7ea44f505d Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 16 Jan 2025 14:11:06 +0930 Subject: [PATCH] Fixes a regression in qgsmaptoolcapture introduced by #58755 which broke snapping in non feature digitizing tools e.g. annotation digitizing tools if there was no active layer or active layer was not spatial. --- src/gui/maptools/qgsmaptoolcapture.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/maptools/qgsmaptoolcapture.cpp b/src/gui/maptools/qgsmaptoolcapture.cpp index caba2d301578..5eb244f3a040 100644 --- a/src/gui/maptools/qgsmaptoolcapture.cpp +++ b/src/gui/maptools/qgsmaptoolcapture.cpp @@ -492,11 +492,15 @@ void QgsMapToolCapture::setCurrentShapeMapTool( const QgsMapToolShapeMetadata *s void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent *e ) { + // If we are adding a record to a non-spatial layer, just return + if ( mCaptureModeFromLayer && !canvas()->currentLayer()->isSpatial() ) + return; + QgsMapToolAdvancedDigitizing::cadCanvasMoveEvent( e ); const QgsPointXY point = e->mapPoint(); - if ( canvas()->currentLayer() && canvas()->currentLayer()->isSpatial() ) - mSnapIndicator->setMatch( e->mapPointMatch() ); + + mSnapIndicator->setMatch( e->mapPointMatch() ); if ( mCurrentCaptureTechnique == Qgis::CaptureTechnique::Shape ) {