From e8ef77e781479fa776f54a9086ef2a24f9b06fe1 Mon Sep 17 00:00:00 2001 From: Sebastian Dietrich Date: Wed, 16 Dec 2015 20:01:19 +0100 Subject: [PATCH] Hide temporary rubberband when maptool is not active. --- python/gui/qgsmaptoolcapture.sip | 3 +++ src/gui/qgsmaptoolcapture.cpp | 11 +++++++++++ src/gui/qgsmaptoolcapture.h | 3 +++ 3 files changed, 17 insertions(+) diff --git a/python/gui/qgsmaptoolcapture.sip b/python/gui/qgsmaptoolcapture.sip index 33200bf13df..e6c60019702 100644 --- a/python/gui/qgsmaptoolcapture.sip +++ b/python/gui/qgsmaptoolcapture.sip @@ -25,6 +25,9 @@ class QgsMapToolCapture : public QgsMapToolAdvancedDigitizing //! destructor virtual ~QgsMapToolCapture(); + //! active the tool + virtual void activate(); + //! deactive the tool virtual void deactivate(); diff --git a/src/gui/qgsmaptoolcapture.cpp b/src/gui/qgsmaptoolcapture.cpp index a94939fd41a..a258bf90416 100644 --- a/src/gui/qgsmaptoolcapture.cpp +++ b/src/gui/qgsmaptoolcapture.cpp @@ -75,8 +75,19 @@ QgsMapToolCapture::~QgsMapToolCapture() } } +void QgsMapToolCapture::activate() +{ + if ( mTempRubberBand ) + mTempRubberBand->show(); + + QgsMapToolAdvancedDigitizing::activate(); +} + void QgsMapToolCapture::deactivate() { + if ( mTempRubberBand ) + mTempRubberBand->hide(); + delete mSnappingMarker; mSnappingMarker = nullptr; diff --git a/src/gui/qgsmaptoolcapture.h b/src/gui/qgsmaptoolcapture.h index 31e012f7465..6c27daddcad 100644 --- a/src/gui/qgsmaptoolcapture.h +++ b/src/gui/qgsmaptoolcapture.h @@ -42,6 +42,9 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing //! destructor virtual ~QgsMapToolCapture(); + //! active the tool + virtual void activate() override; + //! deactive the tool virtual void deactivate() override;