void NewGeom_SalomeViewer::onMouseMove(SUIT_ViewWindow* theView, QMouseEvent* theEvent)
{
myView->setCurrentView(theView);
- OCCViewer_ViewWindow* aViewWnd = dynamic_cast<OCCViewer_ViewWindow*>(theView);
- Handle(AIS_InteractiveContext) aContext = AISContext();
- if (aContext->HasDetected()) // Set focus to provide key events in the view
- aViewWnd->getViewPort()->setFocus(Qt::MouseFocusReason);
emit mouseMove(myView, 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);
}
#include "ModuleBase_Operation.h"
#include "ModuleBase_IWorkshop.h"
#include "ModuleBase_IModule.h"
+#include <ModuleBase_IViewer.h>
#include "ModuleBase_OperationDescription.h"
#include "ModuleBase_OperationFeature.h"
emit keyEnterReleased();
commitOperation();
}
+ case Qt::Key_N:
+ case Qt::Key_P: {
+ bool noModifiers = (theEvent->modifiers() == Qt::NoModifier);
+ if (noModifiers) {
+ ModuleBase_IViewer* aViewer = myWorkshop->viewer();
+ Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
+ Handle(V3d_View) aView = aViewer->activeView();
+ if ((theEvent->key() == Qt::Key_N))
+ aContext->HilightNextDetected(aView);
+ else if ((theEvent->key() == Qt::Key_P))
+ aContext->HilightPreviousDetected(aView);
+ }
+ }
+
break;
default:
isAccepted = false;