From 4f297e3438f92dd0cb0099ed9a8258a83412a7d4 Mon Sep 17 00:00:00 2001 From: Oliver Sander Date: Thu, 4 Jul 2019 21:16:50 +0200 Subject: [PATCH] Do not use slotChangeDrawingToolEngine to reset the drawingEngine The previous code used two consecutive calls to the method slotChangeDrawingToolEngine to reset the m_drawingEngine member (i.e., to delete it and to create a new one from scratch). That worked; however, as a side effect the calls to slotChangeDrawingToolEngine also set the cursor to an arrow, which happens every time one continuous stroke is finished. This went unnoticed because when drawing in presentation mode the cursor is an arrow anyway. However, in anticipation of future patches that change the cursor to a cross-hair when drawing, this explicit setting of the arrow shape needs to go. Therefore this patch replaces the two calls to slotChangeDrawingToolEngine by the code they contain, minus the code to set the cursor shape. The new code is only one line longer, and more readable too. --- ui/presentationwidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp index 50c8d0798..2de49889e 100644 --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -1369,11 +1369,11 @@ QRect PresentationWidget::routeMouseDrawingEvent( QMouseEvent * e ) // add drawing to current page m_frames[ m_frameIndex ]->drawings << m_drawingEngine->endSmoothPath(); - // manually disable and re-enable the pencil mode, so we can do - // cleaning of the actual drawer and create a new one just after + // remove the actual drawer and create a new one just after // that - that gives continuous drawing - slotChangeDrawingToolEngine( QDomElement() ); - slotChangeDrawingToolEngine( m_currentDrawingToolElement ); + delete m_drawingEngine; + m_drawingRect = QRect(); + m_drawingEngine = new SmoothPathEngine( m_currentDrawingToolElement ); // schedule repaint update(); -- GitLab