From dce9bf6c4641dc54b3971a58d7c72fd4b59f4207 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 9 Nov 2015 15:32:50 +0300 Subject: [PATCH] Correction for cursor in edited operation. --- src/PartSet/PartSet_SketcherMgr.cpp | 24 ++++++++++++++++-------- src/PartSet/PartSet_SketcherMgr.h | 4 ++++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index ac3eaf7f9..a5a44efb2 100755 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -197,11 +197,12 @@ void PartSet_SketcherMgr::onEnterViewPort() return; #endif + if (canChangeCursor(getCurrentOperation())) + QApplication::setOverrideCursor(QCursor(Qt::CrossCursor)); + if (!isNestedCreateOperation(getCurrentOperation())) return; - QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));//QIcon(":pictures/button_plus.png").pixmap(20,20))); - operationMgr()->onValidateOperation(); // we need change displayed state of the current operation feature @@ -232,11 +233,12 @@ void PartSet_SketcherMgr::onLeaveViewPort() return; #endif + if (canChangeCursor(getCurrentOperation())) + QApplication::restoreOverrideCursor(); + if (!isNestedCreateOperation(getCurrentOperation())) return; - QApplication::restoreOverrideCursor(); - // the method should be performed if the popup menu is called, // the reset of the current widget should not happen if (myIsPopupMenuActive) @@ -919,15 +921,15 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) void PartSet_SketcherMgr::startNestedSketch(ModuleBase_Operation* theOperation) { - if (isNestedCreateOperation(theOperation) && myIsMouseOverWindow) - QApplication::setOverrideCursor(QCursor(Qt::CrossCursor));//QIcon(":pictures/button_plus.png").pixmap(20,20))); + if (canChangeCursor(theOperation) && myIsMouseOverWindow) + QApplication::setOverrideCursor(QCursor(Qt::CrossCursor)); } -void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp) +void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOperation) { myIsMouseOverViewProcessed = true; operationMgr()->onValidateOperation(); - if (isNestedCreateOperation(theOp) || myModule->sketchReentranceMgr()->isInternalEditActive()) + if (canChangeCursor(theOperation)) QApplication::restoreOverrideCursor(); } @@ -1060,6 +1062,12 @@ bool PartSet_SketcherMgr::canDisplayCurrentCreatedFeature() const return aCanDisplay; } +bool PartSet_SketcherMgr::canChangeCursor(ModuleBase_Operation* theOperation) const +{ + return isNestedCreateOperation(theOperation) || + myModule->sketchReentranceMgr()->isInternalEditActive(); +} + bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const { bool isFoundObject = false; diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index b7e7ffd6e..1800688a3 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -155,6 +155,10 @@ public: /// \return boolean result bool canDisplayCurrentCreatedFeature() const; + /// Returns true if the current operation is nested creation or internal reentrant edit + /// \param theOperation an operation + bool canChangeCursor(ModuleBase_Operation* theOperation) const; + /// Returns state of constraints showing flag bool isConstraintsShown() const { return myIsConstraintsShown; } -- 2.39.2