Skip to content
Permalink
Browse files

Fixes the activation of the shape map tools when digitizing is finish…

…ed (#35023)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
qgis-bot and github-actions committed Mar 16, 2020
1 parent 3e05f07 commit db566f8220f6a9fc897744505190636d8d8097e6
@@ -139,3 +139,13 @@ void QgsMapToolAddCircle::clean()
if ( vLayer )
mLayerType = vLayer->geometryType();
}

void QgsMapToolAddCircle::release( QgsMapMouseEvent *e )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
activate();
}
@@ -46,6 +46,9 @@ class APP_EXPORT QgsMapToolAddCircle: public QgsMapToolCapture
protected:
explicit QgsMapToolAddCircle( QgsMapCanvas *canvas ) = delete; //forbidden

//! Convenient method to release (activate/deactivate) tools
void release( QgsMapMouseEvent *e );

/**
* The parent map tool, e.g. the add feature tool.
* Completed circle will be added to this tool by calling its addCurve() method.
@@ -242,3 +242,13 @@ void QgsMapToolAddCircularString::removeCenterPointRubberBand()
delete mCenterPointRubberBand;
mCenterPointRubberBand = nullptr;
}

void QgsMapToolAddCircularString::release( QgsMapMouseEvent *e )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
activate();
}
@@ -41,6 +41,9 @@ class APP_EXPORT QgsMapToolAddCircularString: public QgsMapToolCapture

protected:

//! Convenient method to release (activate/deactivate) tools
void release( QgsMapMouseEvent *e );

/**
* The parent map tool, e.g. the add feature tool.
* Completed circular strings will be added to this tool by calling its addCurve() method.
@@ -139,3 +139,13 @@ void QgsMapToolAddEllipse::clean()
if ( vLayer )
mLayerType = vLayer->geometryType();
}

void QgsMapToolAddEllipse::release( QgsMapMouseEvent *e )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
activate();
}
@@ -42,6 +42,9 @@ class APP_EXPORT QgsMapToolAddEllipse: public QgsMapToolCapture
protected:
explicit QgsMapToolAddEllipse( QgsMapCanvas *canvas ) = delete; //forbidden

//! Convenient method to release (activate/deactivate) tools
void release( QgsMapMouseEvent *e );

/**
* The parent map tool, e.g. the add feature tool.
* Completed ellipse will be added to this tool by calling its toLineString() method.
@@ -139,3 +139,13 @@ void QgsMapToolAddRectangle::clean()
if ( vLayer )
mLayerType = vLayer->geometryType();
}

void QgsMapToolAddRectangle::release( QgsMapMouseEvent *e )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
activate();
}
@@ -43,6 +43,9 @@ class APP_EXPORT QgsMapToolAddRectangle: public QgsMapToolCapture
protected:
explicit QgsMapToolAddRectangle( QgsMapCanvas *canvas ) = delete; //forbidden

//! Convenient method to release (activate/deactivate) tools
void release( QgsMapMouseEvent *e );

/**
* The parent map tool, e.g. the add feature tool.
* Completed regular shape will be added to this tool by calling its addCurve() method.
@@ -163,3 +163,13 @@ void QgsMapToolAddRegularPolygon::clean()
if ( vLayer )
mLayerType = vLayer->geometryType();
}

void QgsMapToolAddRegularPolygon::release( QgsMapMouseEvent *e )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
activate();
}
@@ -51,6 +51,9 @@ class APP_EXPORT QgsMapToolAddRegularPolygon: public QgsMapToolCapture
//! delete the spin box to enter the number of sides, if it exists
void deleteNumberSidesSpinBox();

//! Convenient method to release (activate/deactivate) tools
void release( QgsMapMouseEvent *e );

/**
* The parent map tool, e.g. the add feature tool.
* Completed regular polygon will be added to this tool by calling its addCurve() method.
@@ -56,11 +56,7 @@ void QgsMapToolCircle2Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
mPoints.append( point );

deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -83,6 +83,7 @@ void QgsMapToolCircle2TangentsPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e
QgisApp::instance()->messageBar()->pushMessage( tr( "Error" ), tr( "Segments are parallels" ),
Qgis::Critical, QgisApp::instance()->messageTimeout() );
deactivate();
activate();
}
else
createRadiusSpinBox();
@@ -100,13 +101,9 @@ void QgsMapToolCircle2TangentsPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e
qDeleteAll( mRubberBands );
mRubberBands.clear();

deactivate();
deleteRadiusSpinBox();
mCenters.clear();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -53,11 +53,7 @@ void QgsMapToolCircle3Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
else if ( e->button() == Qt::RightButton )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -76,11 +76,7 @@ void QgsMapToolCircle3Tangents::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
mTempRubberBand = nullptr;
}
}
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -57,11 +57,7 @@ void QgsMapToolCircleCenterPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
mPoints.append( point );

deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -82,11 +82,7 @@ void QgsMapToolCircularStringCurvePoint::cadCanvasReleaseEvent( QgsMapMouseEvent
}
else if ( e->button() == Qt::RightButton )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -95,11 +95,7 @@ void QgsMapToolCircularStringRadius::cadCanvasReleaseEvent( QgsMapMouseEvent *e
{
if ( !( mPoints.size() % 2 ) )
mPoints.removeLast();
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -56,11 +56,7 @@ void QgsMapToolEllipseCenter2Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e
}
else if ( e->button() == Qt::RightButton )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -54,11 +54,7 @@ void QgsMapToolEllipseCenterPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
else if ( e->button() == Qt::RightButton )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -56,11 +56,7 @@ void QgsMapToolEllipseExtent::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
else if ( e->button() == Qt::RightButton )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -55,11 +55,7 @@ void QgsMapToolEllipseFoci::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
else if ( e->button() == Qt::RightButton )
{
deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -66,11 +66,7 @@ void QgsMapToolRectangle3Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
}
else if ( e->button() == Qt::RightButton )
{
deactivate( );
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -60,11 +60,7 @@ void QgsMapToolRectangleCenter::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
mPoints.append( point );

deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -58,11 +58,7 @@ void QgsMapToolRectangleExtent::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
mPoints.append( point );

deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -65,11 +65,7 @@ void QgsMapToolRegularPolygon2Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e
{
mPoints.append( point );

deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -63,11 +63,7 @@ void QgsMapToolRegularPolygonCenterCorner::cadCanvasReleaseEvent( QgsMapMouseEve
{
mPoints.append( point );

deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

@@ -65,11 +65,7 @@ void QgsMapToolRegularPolygonCenterPoint::cadCanvasReleaseEvent( QgsMapMouseEven
{
mPoints.append( point );

deactivate();
if ( mParentTool )
{
mParentTool->canvasReleaseEvent( e );
}
release( e );
}
}

0 comments on commit db566f8

Please sign in to comment.
You can’t perform that action at this time.