]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #18881(Tuleap): Erase highlighting when mouse is dragging
authorvsv <vsv@opencascade.com>
Tue, 24 Mar 2020 08:22:42 +0000 (11:22 +0300)
committervsv <vsv@opencascade.com>
Tue, 24 Mar 2020 08:22:42 +0000 (11:22 +0300)
src/XGUI/XGUI_ViewerProxy.cpp

index 4b82e3ed627b289936b4967ed3dd504302dcf052..e66a9f060a10ddbe5cdd0bef6108ab6df518947f 100644 (file)
@@ -296,36 +296,40 @@ void XGUI_ViewerProxy::onMouseDoubleClick(AppElements_ViewWindow* theWnd, QMouse
 
 void XGUI_ViewerProxy::onMouseMove(AppElements_ViewWindow* theWnd, QMouseEvent* theEvent)
 {
-  if (myIs2dMode) {
-    bool aHighlight2d =
-      ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-2d", true);
-    if (aHighlight2d) {
-      if (myShowHighlight)
-        eraseHighlight();
-      else
-        updateHighlight();
-    }
-    else {
-      if (myShowHighlight)
-        updateHighlight();
-      else
-        eraseHighlight();
-    }
-  }
+  if (theEvent->buttons() != Qt::NoButton)
+    eraseHighlight();
   else {
-    bool aHighlight3d =
-      ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-3d", false);
-    if (aHighlight3d) {
-      if (myShowHighlight)
-        eraseHighlight();
-      else
-        updateHighlight();
+    if (myIs2dMode) {
+      bool aHighlight2d =
+        ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-2d", true);
+      if (aHighlight2d) {
+        if (myShowHighlight)
+          eraseHighlight();
+        else
+          updateHighlight();
+      }
+      else {
+        if (myShowHighlight)
+          updateHighlight();
+        else
+          eraseHighlight();
+      }
     }
     else {
-      if (myShowHighlight)
-        updateHighlight();
-      else
-        eraseHighlight();
+      bool aHighlight3d =
+        ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-3d", false);
+      if (aHighlight3d) {
+        if (myShowHighlight)
+          eraseHighlight();
+        else
+          updateHighlight();
+      }
+      else {
+        if (myShowHighlight)
+          updateHighlight();
+        else
+          eraseHighlight();
+      }
     }
   }
   emit mouseMove(theWnd, theEvent);
@@ -546,36 +550,40 @@ void XGUI_ViewerProxy::updateHighlight()
 #ifdef HAVE_SALOME
 void XGUI_ViewerProxy::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent)
 {
-  if (myIs2dMode) {
-    bool aHighlight2d =
-      ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-2d", true);
-    if (aHighlight2d) {
-      if (myShowHighlight)
-        eraseHighlight();
-      else
-        updateHighlight();
-    }
-    else {
-      if (myShowHighlight)
-        updateHighlight();
-      else
-        eraseHighlight();
-    }
-  }
+  if (theEvent->buttons() != Qt::NoButton)
+    eraseHighlight();
   else {
-    bool aHighlight3d =
-      ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-3d", false);
-    if (aHighlight3d) {
-      if (myShowHighlight)
-        eraseHighlight();
-      else
-        updateHighlight();
+    if (myIs2dMode) {
+      bool aHighlight2d =
+        ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-2d", true);
+      if (aHighlight2d) {
+        if (myShowHighlight)
+          eraseHighlight();
+        else
+          updateHighlight();
+      }
+      else {
+        if (myShowHighlight)
+          updateHighlight();
+        else
+          eraseHighlight();
+      }
     }
     else {
-      if (myShowHighlight)
-        updateHighlight();
-      else
-        eraseHighlight();
+      bool aHighlight3d =
+        ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-3d", false);
+      if (aHighlight3d) {
+        if (myShowHighlight)
+          eraseHighlight();
+        else
+          updateHighlight();
+      }
+      else {
+        if (myShowHighlight)
+          updateHighlight();
+        else
+          eraseHighlight();
+      }
     }
   }
   emit mouseMove(theWnd, theEvent);