]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Provide processing of 'N' and 'P' keys in viewer to select overlayed objects.
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 30 Dec 2014 14:18:34 +0000 (17:18 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 30 Dec 2014 14:18:34 +0000 (17:18 +0300)
src/NewGeom/NewGeom_SalomeViewer.cpp

index d83e344d46255d409815931935d172f88acd1815..3a105024877175d8ef4dfc416e2dddeb9c627582 100644 (file)
@@ -144,19 +144,33 @@ void NewGeom_SalomeViewer::onMouseDoubleClick(SUIT_ViewWindow*, QMouseEvent* the
 }
 
 //**********************************************
-void NewGeom_SalomeViewer::onMouseMove(SUIT_ViewWindow*, QMouseEvent* theEvent)
+void NewGeom_SalomeViewer::onMouseMove(SUIT_ViewWindow* theView, QMouseEvent* theEvent)
 {
+  OCCViewer_ViewWindow* aViewWnd = dynamic_cast<OCCViewer_ViewWindow*>(theView);
+  Handle(AIS_InteractiveContext) aContext = AISContext();
+  if (aContext->HasDetected())
+    aViewWnd->getViewPort()->setFocus(Qt::MouseFocusReason);
   emit mouseMove(myView, theEvent);
 }
 
 //**********************************************
-void NewGeom_SalomeViewer::onKeyPress(SUIT_ViewWindow*, QKeyEvent* theEvent)
+void NewGeom_SalomeViewer::onKeyPress(SUIT_ViewWindow* theView, QKeyEvent* theEvent)
 {
+  OCCViewer_ViewWindow* aViewWnd = dynamic_cast<OCCViewer_ViewWindow*>(theView);
+  Handle(AIS_InteractiveContext) aContext = AISContext();
+  Handle(V3d_View) aView = aViewWnd->getViewPort()->getView();
+
+  bool noModifiers = (theEvent->modifiers() == Qt::NoModifier);
+  if ((theEvent->key() == Qt::Key_N) && noModifiers) {
+    aContext->HilightNextDetected(aView);
+  } else if ((theEvent->key() == Qt::Key_P) && noModifiers) {
+    aContext->HilightPreviousDetected(aView);
+  }
   emit keyPress(myView, theEvent);
 }
 
 //**********************************************
-void NewGeom_SalomeViewer::onKeyRelease(SUIT_ViewWindow*, QKeyEvent* theEvent)
+void NewGeom_SalomeViewer::onKeyRelease(SUIT_ViewWindow* theView, QKeyEvent* theEvent)
 {
   emit keyRelease(myView, theEvent);
 }