diff --git a/src/app/qgsmaptooladdcircle.h b/src/app/qgsmaptooladdcircle.h index d2795161987..8073f8c46f4 100644 --- a/src/app/qgsmaptooladdcircle.h +++ b/src/app/qgsmaptooladdcircle.h @@ -55,6 +55,7 @@ class QgsMapToolAddCircle: public QgsMapToolCapture QgsCircle mCircle; private: + //! convenient method to clean members void clean(); }; diff --git a/src/app/qgsmaptooladdellipse.cpp b/src/app/qgsmaptooladdellipse.cpp index 95cee587201..a8c1bc4afb3 100644 --- a/src/app/qgsmaptooladdellipse.cpp +++ b/src/app/qgsmaptooladdellipse.cpp @@ -26,7 +26,6 @@ QgsMapToolAddEllipse::QgsMapToolAddEllipse( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode ) : QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode ) , mParentTool( parentTool ) - , mEllipse( QgsEllipse() ) { clean(); } diff --git a/src/app/qgsmaptooladdellipse.h b/src/app/qgsmaptooladdellipse.h index d90160d194a..16349e0a8aa 100644 --- a/src/app/qgsmaptooladdellipse.h +++ b/src/app/qgsmaptooladdellipse.h @@ -24,7 +24,6 @@ class QgsGeometryRubberBand; class QgsMapToolAddEllipse: public QgsMapToolCapture { Q_OBJECT - void clean(); public: QgsMapToolAddEllipse( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine ); ~QgsMapToolAddEllipse(); @@ -37,18 +36,22 @@ class QgsMapToolAddEllipse: public QgsMapToolCapture void activate() override; protected: - explicit QgsMapToolAddEllipse( QgsMapCanvas *canvas ); //forbidden + explicit QgsMapToolAddEllipse( QgsMapCanvas *canvas ) = delete; //forbidden /** The parent map tool, e.g. the add feature tool. * Completed ellipse will be added to this tool by calling its toLineString() method. * */ - QgsMapToolCapture *mParentTool; + QgsMapToolCapture *mParentTool = nullptr; //! Ellipse points (in map coordinates) QgsPointSequence mPoints; //! The rubberband to show the ellipse currently working on QgsGeometryRubberBand *mTempRubberBand = nullptr; //! Ellipse QgsEllipse mEllipse; + + private: + //! convenient method to clean members + void clean(); }; #endif // QGSMAPTOOLADDELLIPSE_H diff --git a/src/app/qgsmaptooladdrectangle.cpp b/src/app/qgsmaptooladdrectangle.cpp index 1f39156941e..c3c967364c1 100644 --- a/src/app/qgsmaptooladdrectangle.cpp +++ b/src/app/qgsmaptooladdrectangle.cpp @@ -27,7 +27,6 @@ QgsMapToolAddRectangle::QgsMapToolAddRectangle( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode ) : QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode ) , mParentTool( parentTool ) - , mRectangle( QgsRectangle() ) { clean(); } diff --git a/src/app/qgsmaptooladdrectangle.h b/src/app/qgsmaptooladdrectangle.h index a8b1237de29..83aa0b1836e 100644 --- a/src/app/qgsmaptooladdrectangle.h +++ b/src/app/qgsmaptooladdrectangle.h @@ -26,8 +26,6 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture { Q_OBJECT - //! convenient method to clean members - void clean(); public: QgsMapToolAddRectangle( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine ); ~QgsMapToolAddRectangle(); @@ -40,12 +38,12 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture void activate() override; protected: - explicit QgsMapToolAddRectangle( QgsMapCanvas *canvas ); //forbidden + explicit QgsMapToolAddRectangle( QgsMapCanvas *canvas ) = delete; //forbidden /** The parent map tool, e.g. the add feature tool. * Completed regular shape will be added to this tool by calling its addCurve() method. * */ - QgsMapToolCapture *mParentTool; + QgsMapToolCapture *mParentTool = nullptr; //! Regular Shape points (in map coordinates) QgsPointSequence mPoints; //! The rubberband to show the rectangle currently working on @@ -85,6 +83,8 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture double mDistance2 = 0.0; //! Convenient member for the side where the second distance is drawn or when map is rotated. int mSide = 1; + //! convenient method to clean members + void clean(); }; #endif // QGSMAPTOOLADDRECTANGLE_H diff --git a/src/app/qgsmaptooladdregularpolygon.cpp b/src/app/qgsmaptooladdregularpolygon.cpp index 60f0b6b6592..cb69130925c 100644 --- a/src/app/qgsmaptooladdregularpolygon.cpp +++ b/src/app/qgsmaptooladdregularpolygon.cpp @@ -26,7 +26,6 @@ QgsMapToolAddRegularPolygon::QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode ) : QgsMapToolCapture( canvas, QgisApp::instance()->cadDockWidget(), mode ) , mParentTool( parentTool ) - , mRegularPolygon( QgsRegularPolygon() ) { clean(); } diff --git a/src/app/qgsmaptooladdregularpolygon.h b/src/app/qgsmaptooladdregularpolygon.h index 9e51a9aa800..e12fdea607e 100644 --- a/src/app/qgsmaptooladdregularpolygon.h +++ b/src/app/qgsmaptooladdregularpolygon.h @@ -25,7 +25,6 @@ class QSpinBox; class QgsMapToolAddRegularPolygon: public QgsMapToolCapture { Q_OBJECT - void clean(); public: QgsMapToolAddRegularPolygon( QgsMapToolCapture *parentTool, QgsMapCanvas *canvas, CaptureMode mode = CaptureLine ); @@ -39,7 +38,7 @@ class QgsMapToolAddRegularPolygon: public QgsMapToolCapture void activate() override; protected: - explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ); //forbidden + explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ) = delete; //forbidden std::unique_ptr mNumberSidesSpinBox; int mNumberSides; @@ -52,13 +51,17 @@ class QgsMapToolAddRegularPolygon: public QgsMapToolCapture /** The parent map tool, e.g. the add feature tool. * Completed regular polygon will be added to this tool by calling its addCurve() method. * */ - QgsMapToolCapture *mParentTool; + QgsMapToolCapture *mParentTool = nullptr; //! Regular Shape points (in map coordinates) QgsPointSequence mPoints; //! The rubberband to show the regular polygon currently working on QgsGeometryRubberBand *mTempRubberBand = nullptr; //! Regular shape as a regular polygon QgsRegularPolygon mRegularPolygon; + + private: + //! convenient method to clean members + void clean(); }; #endif // QGSMAPTOOLADDREGULARPOLYGON_H