Permalink
Browse files

Merge pull request #598 from martinvanzijl/Bug_565_Cancel_Poly-Line

Fix for #565. ESC key now clears polyline.
  • Loading branch information...
2 parents 219fe84 + c1cfdd3 commit 80b5185027c2407499ed753a2cf8aea9b7b747ce @chchwy chchwy committed on GitHub Feb 12, 2017
Showing with 9 additions and 0 deletions.
  1. +7 −0 core_lib/interface/scribblearea.cpp
  2. +1 −0 core_lib/interface/scribblearea.h
  3. +1 −0 core_lib/tool/polylinetool.cpp
@@ -1216,6 +1216,13 @@ void ScribbleArea::drawPolyline( QList<QPointF> points, QPointF endPoint )
}
}
+void ScribbleArea::cancelPolyline(QList<QPointF> points)
+{
+ // Clear the in-progress polyline from the bitmap buffer.
+ clearBitmapBuffer();
+ updateCurrentFrame();
+}
+
void ScribbleArea::endPolyline( QList<QPointF> points )
{
if ( !areLayersSane() )
@@ -162,6 +162,7 @@ public slots:
public:
void drawPolyline( QList<QPointF> points, QPointF lastPoint );
void endPolyline( QList<QPointF> points );
+ void cancelPolyline( QList<QPointF> points );
void drawLine( QPointF P1, QPointF P2, QPen pen, QPainter::CompositionMode cm );
void drawPath( QPainterPath path, QPen pen, QBrush brush, QPainter::CompositionMode cm );
@@ -137,6 +137,7 @@ bool PolylineTool::keyPressEvent( QKeyEvent *event )
case Qt::Key_Escape:
if ( mPoints.size() > 0 ) {
+ mScribbleArea->cancelPolyline( mPoints );
clear();
return true;
}

0 comments on commit 80b5185

Please sign in to comment.