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