From: vsv Date: Tue, 30 Dec 2014 14:18:34 +0000 (+0300) Subject: Provide processing of 'N' and 'P' keys in viewer to select overlayed objects. X-Git-Tag: V_0.7.0_rc1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=deb19bc5cba9a2a8f8b16ddb0c56814729fb50eb;p=modules%2Fshaper.git Provide processing of 'N' and 'P' keys in viewer to select overlayed objects. --- diff --git a/src/NewGeom/NewGeom_SalomeViewer.cpp b/src/NewGeom/NewGeom_SalomeViewer.cpp index d83e344d4..3a1050248 100644 --- a/src/NewGeom/NewGeom_SalomeViewer.cpp +++ b/src/NewGeom/NewGeom_SalomeViewer.cpp @@ -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(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(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); }