Skip to content
Permalink
Browse files

Fixes #25597 Allow use of Backspace key to undo vertex added

  • Loading branch information
lbartoletti authored and nyalldawson committed Jan 28, 2020
1 parent ea1e7ff commit 50a8f1ab35b1da02dfa971823116a812ebaf0761
@@ -52,6 +52,28 @@ void QgsMapToolAddCircle::keyPressEvent( QKeyEvent *e )
if ( mParentTool )
mParentTool->keyPressEvent( e );
}

if ( e && e->key() == Qt::Key_Backspace )
{
if ( mPoints.size() == 1 )
{

if ( mTempRubberBand )
{
delete mTempRubberBand;
mTempRubberBand = nullptr;
}

mPoints.clear();
}
else if ( mPoints.size() > 1 )
{
mPoints.removeLast();

}
if ( mParentTool )
mParentTool->keyPressEvent( e );
}
}

void QgsMapToolAddCircle::keyReleaseEvent( QKeyEvent *e )
@@ -52,6 +52,28 @@ void QgsMapToolAddEllipse::keyPressEvent( QKeyEvent *e )
if ( mParentTool )
mParentTool->keyPressEvent( e );
}

if ( e && e->key() == Qt::Key_Backspace )
{
if ( mPoints.size() == 1 )
{

if ( mTempRubberBand )
{
delete mTempRubberBand;
mTempRubberBand = nullptr;
}

mPoints.clear();
}
else if ( mPoints.size() > 1 )
{
mPoints.removeLast();

}
if ( mParentTool )
mParentTool->keyPressEvent( e );
}
}

void QgsMapToolAddEllipse::keyReleaseEvent( QKeyEvent *e )
@@ -53,6 +53,28 @@ void QgsMapToolAddRectangle::keyPressEvent( QKeyEvent *e )
if ( mParentTool )
mParentTool->keyPressEvent( e );
}

if ( e && e->key() == Qt::Key_Backspace )
{
if ( mPoints.size() == 1 )
{

if ( mTempRubberBand )
{
delete mTempRubberBand;
mTempRubberBand = nullptr;
}

mPoints.clear();
}
else if ( mPoints.size() > 1 )
{
mPoints.removeLast();

}
if ( mParentTool )
mParentTool->keyPressEvent( e );
}
}

void QgsMapToolAddRectangle::keyReleaseEvent( QKeyEvent *e )
@@ -72,6 +72,28 @@ void QgsMapToolAddRegularPolygon::keyPressEvent( QKeyEvent *e )
if ( mParentTool )
mParentTool->keyPressEvent( e );
}

if ( e && e->key() == Qt::Key_Backspace )
{
if ( mPoints.size() == 1 )
{

if ( mTempRubberBand )
{
delete mTempRubberBand;
mTempRubberBand = nullptr;
}

mPoints.clear();
}
else if ( mPoints.size() > 1 )
{
mPoints.removeLast();

}
if ( mParentTool )
mParentTool->keyPressEvent( e );
}
}

void QgsMapToolAddRegularPolygon::keyReleaseEvent( QKeyEvent *e )

0 comments on commit 50a8f1a

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