Skip to content

Commit

Permalink
Fix error when the tools was changed. setParentTool is not needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Aug 22, 2017
1 parent 5808cc1 commit 508aef0
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 102 deletions.
22 changes: 0 additions & 22 deletions src/app/qgsmaptooladdcircle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ QgsMapToolAddCircle::QgsMapToolAddCircle( QgsMapToolCapture *parentTool, QgsMapC
, mCircle( QgsCircle() )
{
clean();
if ( mCanvas )
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddCircle::setParentTool );
}
}

QgsMapToolAddCircle::QgsMapToolAddCircle( QgsMapCanvas *canvas )
Expand All @@ -43,31 +39,13 @@ QgsMapToolAddCircle::QgsMapToolAddCircle( QgsMapCanvas *canvas )
, mCircle( QgsCircle() )
{
clean();
if ( mCanvas )
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddCircle::setParentTool );
}
}

QgsMapToolAddCircle::~QgsMapToolAddCircle()
{
clean();
}

void QgsMapToolAddCircle::setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool )
{
QgsMapToolCapture *tool = dynamic_cast<QgsMapToolCapture *>( oldTool );
QgsMapToolAddCircle *csTool = dynamic_cast<QgsMapToolAddCircle *>( oldTool );
if ( csTool && newTool == this )
{
mParentTool = csTool->mParentTool;
}
else if ( tool && newTool == this )
{
mParentTool = tool;
}
}

void QgsMapToolAddCircle::keyPressEvent( QKeyEvent *e )
{
if ( e && e->isAutoRepeat() )
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgsmaptooladdcircle.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class QgsMapToolAddCircle: public QgsMapToolCapture

void activate() override;

private slots:
void setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool );

protected:
explicit QgsMapToolAddCircle( QgsMapCanvas *canvas ); //forbidden

Expand Down
22 changes: 0 additions & 22 deletions src/app/qgsmaptooladdellipse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ QgsMapToolAddEllipse::QgsMapToolAddEllipse( QgsMapToolCapture *parentTool, QgsMa
, mEllipse( QgsEllipse() )
{
clean();
if ( mCanvas )
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddEllipse::setParentTool );
}
}

QgsMapToolAddEllipse::QgsMapToolAddEllipse( QgsMapCanvas *canvas )
Expand All @@ -43,31 +39,13 @@ QgsMapToolAddEllipse::QgsMapToolAddEllipse( QgsMapCanvas *canvas )
, mEllipse( QgsEllipse() )
{
clean();
if ( mCanvas )
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddEllipse::setParentTool );
}
}

QgsMapToolAddEllipse::~QgsMapToolAddEllipse()
{
clean();
}

void QgsMapToolAddEllipse::setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool )
{
QgsMapToolCapture *tool = dynamic_cast<QgsMapToolCapture *>( oldTool );
QgsMapToolAddEllipse *csTool = dynamic_cast<QgsMapToolAddEllipse *>( oldTool );
if ( csTool && newTool == this )
{
mParentTool = csTool->mParentTool;
}
else if ( tool && newTool == this )
{
mParentTool = tool;
}
}

void QgsMapToolAddEllipse::keyPressEvent( QKeyEvent *e )
{
if ( e && e->isAutoRepeat() )
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgsmaptooladdellipse.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ class QgsMapToolAddEllipse: public QgsMapToolCapture

void activate() override;

private slots:
void setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool );

protected:
explicit QgsMapToolAddEllipse( QgsMapCanvas *canvas ); //forbidden

Expand Down
23 changes: 0 additions & 23 deletions src/app/qgsmaptooladdrectangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ QgsMapToolAddRectangle::QgsMapToolAddRectangle( QgsMapToolCapture *parentTool, Q
, mRectangle( QgsRectangle() )
{
clean();
if ( mCanvas )
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddRectangle::setParentTool );
}
}

QgsMapToolAddRectangle::QgsMapToolAddRectangle( QgsMapCanvas *canvas )
Expand All @@ -44,32 +40,13 @@ QgsMapToolAddRectangle::QgsMapToolAddRectangle( QgsMapCanvas *canvas )
, mRectangle( QgsRectangle() )
{
clean();
if ( mCanvas )
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddRectangle::setParentTool );
}
}

QgsMapToolAddRectangle::~QgsMapToolAddRectangle()
{
clean();
}

void QgsMapToolAddRectangle::setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool )
{

QgsMapToolCapture *tool = dynamic_cast<QgsMapToolCapture *>( oldTool );
QgsMapToolAddRectangle *csTool = dynamic_cast<QgsMapToolAddRectangle *>( oldTool );
if ( csTool && newTool == this )
{
mParentTool = csTool->mParentTool;
}
else if ( tool && newTool == this )
{
mParentTool = tool;
}
}

void QgsMapToolAddRectangle::keyPressEvent( QKeyEvent *e )
{
if ( e && e->isAutoRepeat() )
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgsmaptooladdrectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ class QgsMapToolAddRectangle: public QgsMapToolCapture

void activate() override;

private slots:
void setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool );

protected:
explicit QgsMapToolAddRectangle( QgsMapCanvas *canvas ); //forbidden

Expand Down
23 changes: 0 additions & 23 deletions src/app/qgsmaptooladdregularpolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ QgsMapToolAddRegularPolygon::QgsMapToolAddRegularPolygon( QgsMapToolCapture *par
, mRegularPolygon( QgsRegularPolygon() )
{
clean();
if ( mCanvas )
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddRegularPolygon::setParentTool );
}
}

QgsMapToolAddRegularPolygon::QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas )
Expand All @@ -43,32 +39,13 @@ QgsMapToolAddRegularPolygon::QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas )
, mRegularPolygon( QgsRegularPolygon() )
{
clean();
if ( mCanvas )
{
connect( mCanvas, &QgsMapCanvas::mapToolSet, this, &QgsMapToolAddRegularPolygon::setParentTool );
}
}

QgsMapToolAddRegularPolygon::~QgsMapToolAddRegularPolygon()
{
clean();
}

void QgsMapToolAddRegularPolygon::setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool )
{
clean();
QgsMapToolCapture *tool = dynamic_cast<QgsMapToolCapture *>( oldTool );
QgsMapToolAddRegularPolygon *csTool = dynamic_cast<QgsMapToolAddRegularPolygon *>( oldTool );
if ( csTool && newTool == this )
{
mParentTool = csTool->mParentTool;
}
else if ( tool && newTool == this )
{
mParentTool = tool;
}
}

void QgsMapToolAddRegularPolygon::createNumberSidesSpinBox()
{
deleteNumberSidesSpinBox();
Expand Down
3 changes: 0 additions & 3 deletions src/app/qgsmaptooladdregularpolygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class QgsMapToolAddRegularPolygon: public QgsMapToolCapture

void activate() override;

private slots:
void setParentTool( QgsMapTool *newTool, QgsMapTool *oldTool );

protected:
explicit QgsMapToolAddRegularPolygon( QgsMapCanvas *canvas ); //forbidden

Expand Down

0 comments on commit 508aef0

Please sign in to comment.