From b79c9876ea6468eb6ab8f4b861ace5d1a51a400a Mon Sep 17 00:00:00 2001 From: sirius Date: Thu, 30 Jan 2020 14:02:50 +0800 Subject: [PATCH] roll back the empty painterpath generated by click mouse --- PaintPlugin/src/DkPaintPlugin.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PaintPlugin/src/DkPaintPlugin.cpp b/PaintPlugin/src/DkPaintPlugin.cpp index 50c269f..a7ca787 100644 --- a/PaintPlugin/src/DkPaintPlugin.cpp +++ b/PaintPlugin/src/DkPaintPlugin.cpp @@ -293,6 +293,13 @@ void DkPaintViewPort::mousePressEvent(QMouseEvent *event) { if(QRectF(QPointF(), viewport->getImage().size()).contains(mapToImage(event->pos()))) { isOutside = false; + + // roll back the empty painterpath generated by click mouse + if(!paths.empty()) + if(paths.last().isEmpty()) + undoLastPaint(); + + // create new painterpath paths.append(QPainterPath()); paths.last().moveTo(mapToImage(event->pos())); //paths.last().lineTo(mapToImage(event->pos())+QPointF(0.1,0));