]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2929: Make reaction on H button less depended on viewer focus
authorvsv <vsv@opencascade.com>
Tue, 30 Jul 2019 16:49:22 +0000 (19:49 +0300)
committervsv <vsv@opencascade.com>
Tue, 30 Jul 2019 16:49:22 +0000 (19:49 +0300)
src/ModuleBase/ModuleBase_IViewer.cpp
src/ModuleBase/ModuleBase_IViewer.h
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_ViewerProxy.cpp
src/XGUI/XGUI_ViewerProxy.h

index ef7b0b7c336084503a06e2b79df01da0006c340b..cd743d93f0e3f26294ce53c019001d7dc8a24962 100644 (file)
@@ -22,7 +22,7 @@
 Handle(Prs3d_Drawer) ModuleBase_IViewer::DefaultHighlightDrawer;
 
 ModuleBase_IViewer::ModuleBase_IViewer(QObject* theParent)
-  : QObject(theParent), myIs2dMode(false)
+  : QObject(theParent), myIs2dMode(false), myShowHighlight(false)
 {
 
 }
index 77c10a45c230c8979cf5615156aa9ba47a1b8af3..c52c0d952907c43ee2e4a674413165f5714e3f51 100644 (file)
@@ -181,6 +181,16 @@ Q_OBJECT
   // \param theText is a title
   virtual void setColorScaleTitle(const QString& theText) = 0;
 
+  /// Switches On additional highlight for objects preselection
+  void showSelectionHighlight() {
+    myShowHighlight = true;
+  }
+
+  /// Switches Off additional highlight for objects preselection
+  void hideSelectionHighlight() {
+    myShowHighlight = false;
+  }
+
   static Handle(Prs3d_Drawer) DefaultHighlightDrawer;
 
 signals:
@@ -235,6 +245,8 @@ signals:
     QMap<Handle(V3d_View), double> myWindowScale;
 
     bool myIs2dMode;
+
+    bool myShowHighlight;
 };
 
 #endif
index 6a16390326fd0c6fcd3e8bcaaf05ee32936fab01..3146a923c7689a119960e1027790039593b4e25a 100644 (file)
@@ -94,13 +94,7 @@ public:
       else if (theEvent->type() == QEvent::KeyPress) {
         QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*>(theEvent);
         myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier);
-        switch (aKeyEvent->key()) {
-          case Qt::Key_Escape:
-            isAccepted = myOperationMgr->onKeyPressed(theObject, aKeyEvent);
-          break;
-          default:
-            break;
-        }
+        isAccepted = myOperationMgr->onKeyPressed(theObject, aKeyEvent);
       }
     }
     if (!isAccepted)
@@ -688,10 +682,13 @@ bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent* theEvent)
           isAccepted = true;
         }
       }
-    }
-    break;
-    break;
-    default:
+      }
+      break;
+   case Qt::Key_H:
+     if ((theEvent->modifiers() == Qt::NoModifier))
+      myWorkshop->viewer()->hideSelectionHighlight();
+     break;
+   default:
       isAccepted = false;
       break;
   }
@@ -744,6 +741,10 @@ bool XGUI_OperationMgr::onKeyPressed(QObject *theObject, QKeyEvent* theEvent)
       }
     }
     break;
+    case Qt::Key_H:
+      if ((theEvent->modifiers() == Qt::NoModifier))
+        myWorkshop->viewer()->showSelectionHighlight();
+      break;
   }
   return isAccepted;
 }
index 7d86a013fefc6fa2082110c1198e7d209700f5f1..175ed87790b880f08b2aa83415bac3c2c7e2c19d 100644 (file)
@@ -48,7 +48,7 @@
 
 XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop* theParent)
     : ModuleBase_IViewer(theParent),
-      myWorkshop(theParent), myShowHighlight(false)
+      myWorkshop(theParent)
 {
 }
 
index 3f86889606fe9ceea2b3b84dea3f802c1054e826..bb3a445d5ddc6f6fa97a81e6232221c8bcc3bc35 100644 (file)
@@ -210,7 +210,6 @@ private slots:
   ResultPtr myResult;
   AIS_ListOfInteractive myHighlights;
 
-  bool myShowHighlight;
 };
 
 #endif