]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Correction for cursor in edited operation.
authornds <nds@opencascade.com>
Mon, 9 Nov 2015 12:32:50 +0000 (15:32 +0300)
committernds <nds@opencascade.com>
Mon, 9 Nov 2015 12:32:50 +0000 (15:32 +0300)
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h

index ac3eaf7f9449aed7c41b43f2fbed95da31645513..a5a44efb207e15989490171734ae8ecbf408592d 100755 (executable)
@@ -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;
index b7e7ffd6e5333d5a0bfd5c5aa716f2a04284a99f..1800688a3a1b4049f07ee17cba465887f74daee0 100644 (file)
@@ -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; }