From 2cf0c49955b910e50fb2e1e44e61895bbecadb84 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Mon, 16 May 2022 15:29:32 +0200 Subject: [PATCH] DrawSketchHandler: mechanism to update the cursor --- src/Mod/Sketcher/Gui/DrawSketchHandler.cpp | 14 +++++++++----- src/Mod/Sketcher/Gui/DrawSketchHandler.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp index d9f9c897a6..6101114aef 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.cpp @@ -54,7 +54,6 @@ #include "ViewProviderSketch.h" #include "CommandConstraints.h" - using namespace SketcherGui; using namespace Sketcher; @@ -230,10 +229,7 @@ void DrawSketchHandler::activate(ViewProviderSketch * vp) { sketchgui = vp; - auto cursorstring = getCrosshairCursorString(); - - if(cursorstring != QString::fromLatin1("None")) - setCrosshairCursor(cursorstring); + updateCursor(); this->preActivated(); this->activated(); @@ -426,6 +422,14 @@ void DrawSketchHandler::addCursorTail( std::vector &pixmaps ) { } } +void DrawSketchHandler::updateCursor() +{ + auto cursorstring = getCrosshairCursorString(); + + if(cursorstring != QString::fromLatin1("None")) + setCrosshairCursor(cursorstring); +} + void DrawSketchHandler::applyCursor(void) { applyCursor(actCursor); diff --git a/src/Mod/Sketcher/Gui/DrawSketchHandler.h b/src/Mod/Sketcher/Gui/DrawSketchHandler.h index 61d3d55fea..5a2ee3c695 100644 --- a/src/Mod/Sketcher/Gui/DrawSketchHandler.h +++ b/src/Mod/Sketcher/Gui/DrawSketchHandler.h @@ -162,6 +162,7 @@ protected: void setSvgCursor(const QString &svgName, int x, int y, const std::map& colorMapping = std::map()); void addCursorTail(std::vector &pixmaps); + void updateCursor(); void unsetCursor(void); void applyCursor(void); void applyCursor(QCursor &newCursor);