From c4b92096a0194f754dba40e3ecce4e3afb6f872f Mon Sep 17 00:00:00 2001 From: Yoann Quenach de Quivillic Date: Tue, 17 Dec 2024 15:55:37 +0100 Subject: [PATCH] Do not uncheck the QAction when tool is still active --- src/app/qgsmaptooltrimextendfeature.cpp | 15 +++++++++------ src/app/qgsmaptooltrimextendfeature.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/app/qgsmaptooltrimextendfeature.cpp b/src/app/qgsmaptooltrimextendfeature.cpp index 90f8db012f1d..37b60e16f8cf 100644 --- a/src/app/qgsmaptooltrimextendfeature.cpp +++ b/src/app/qgsmaptooltrimextendfeature.cpp @@ -278,13 +278,13 @@ void QgsMapToolTrimExtendFeature::canvasReleaseEvent( QgsMapMouseEvent *e ) // If Shift is pressed, keep the tool active with its reference feature if ( !( e->modifiers() & Qt::ShiftModifier ) ) - deactivate(); + reset(); break; } } else if ( e->button() == Qt::RightButton ) { - deactivate(); + reset(); } } @@ -297,7 +297,7 @@ void QgsMapToolTrimExtendFeature::keyPressEvent( QKeyEvent *e ) if ( e && e->key() == Qt::Key_Escape ) { - deactivate(); + reset(); } } @@ -363,8 +363,7 @@ void QgsMapToolTrimExtendFeature::extendLimit() mRubberBandLimitExtend->setToGeometry( geom, refLayer ); mRubberBandLimitExtend->show(); } - -void QgsMapToolTrimExtendFeature::deactivate() +void QgsMapToolTrimExtendFeature::reset() { mStep = StepLimit; mIsModified = false; @@ -375,7 +374,11 @@ void QgsMapToolTrimExtendFeature::deactivate() mRubberBandLimitExtend.reset(); mRubberBandExtend.reset(); mRubberBandIntersection.reset(); - QgsMapTool::deactivate(); mVlayer = nullptr; mLimitLayer = nullptr; } +void QgsMapToolTrimExtendFeature::deactivate() +{ + reset(); + QgsMapTool::deactivate(); +} diff --git a/src/app/qgsmaptooltrimextendfeature.h b/src/app/qgsmaptooltrimextendfeature.h index 9e46b64d15bd..4f2542aabda4 100644 --- a/src/app/qgsmaptooltrimextendfeature.h +++ b/src/app/qgsmaptooltrimextendfeature.h @@ -41,6 +41,7 @@ class APP_EXPORT QgsMapToolTrimExtendFeature : public QgsMapToolEdit private slots: // Recompute the extended limit void extendLimit(); + void reset(); private: //! Rubberband that highlights the limit segment