From 4feb9376842703d34e2c3579de6c6fc448fb04e3 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 3 Oct 2018 16:07:10 +0300 Subject: [PATCH] Issue #2673: Provide N and P keys for traversing of highlighted entities --- src/ModuleBase/ModuleBase_IViewer.h | 3 +++ src/XGUI/XGUI_OperationMgr.cpp | 5 ++++- src/XGUI/XGUI_ViewerProxy.h | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index c58173af9..adfa441ec 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -129,6 +129,9 @@ Q_OBJECT /// Fit all along Z (perpendicular to display) //virtual void Zfitall() = 0; + /// Show highlight for pre-highlighted sub-shape + virtual void updateHighlight() {} + static Handle(Prs3d_Drawer) DefaultHighlightDrawer; signals: diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 1110d1b8d..a5f5b1bd6 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -644,9 +644,10 @@ void XGUI_OperationMgr::onOperationStopped() bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent* theEvent) { + bool isAccepted = false; + // Let the manager decide what to do with the given key combination. ModuleBase_Operation* anOperation = currentOperation(); - bool isAccepted = false; switch (theEvent->key()) { case Qt::Key_Tab: case Qt::Key_Backtab: @@ -684,6 +685,8 @@ bool XGUI_OperationMgr::onKeyReleased(QObject *theObject, QKeyEvent* theEvent) aContext->HilightNextDetected(aView); else if ((theEvent->key() == Qt::Key_P)) aContext->HilightPreviousDetected(aView); + aViewer->updateHighlight(); + isAccepted = true; } } } diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 178b99ab2..f9f104ff3 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -118,6 +118,8 @@ Q_OBJECT /// by mouse drugging. If this is impossible thet it has to return False. virtual bool canDragByMouse() const; + virtual void updateHighlight(); + // Fit all along Z (perpendicular to display) //virtual void Zfitall(); @@ -159,7 +161,6 @@ private slots: private: void displayHighlight(); void eraseHighlight(); - void updateHighlight(); XGUI_Workshop* myWorkshop; ResultPtr myResult; -- 2.30.2