From: vsv Date: Tue, 30 Jul 2019 16:49:22 +0000 (+0300) Subject: Issue #2929: Make reaction on H button less depended on viewer focus X-Git-Tag: VEDF2019Lot4~67 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ff38d9ae752db4064d74c6c94b54afc1e90a96ab;p=modules%2Fshaper.git Issue #2929: Make reaction on H button less depended on viewer focus --- diff --git a/src/ModuleBase/ModuleBase_IViewer.cpp b/src/ModuleBase/ModuleBase_IViewer.cpp index ef7b0b7c3..cd743d93f 100644 --- a/src/ModuleBase/ModuleBase_IViewer.cpp +++ b/src/ModuleBase/ModuleBase_IViewer.cpp @@ -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) { } diff --git a/src/ModuleBase/ModuleBase_IViewer.h b/src/ModuleBase/ModuleBase_IViewer.h index 77c10a45c..c52c0d952 100644 --- a/src/ModuleBase/ModuleBase_IViewer.h +++ b/src/ModuleBase/ModuleBase_IViewer.h @@ -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 myWindowScale; bool myIs2dMode; + + bool myShowHighlight; }; #endif diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index 6a1639032..3146a923c 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -94,13 +94,7 @@ public: else if (theEvent->type() == QEvent::KeyPress) { QKeyEvent* aKeyEvent = dynamic_cast(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; } diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index 7d86a013f..175ed8779 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -48,7 +48,7 @@ XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop* theParent) : ModuleBase_IViewer(theParent), - myWorkshop(theParent), myShowHighlight(false) + myWorkshop(theParent) { } diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index 3f8688960..bb3a445d5 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -210,7 +210,6 @@ private slots: ResultPtr myResult; AIS_ListOfInteractive myHighlights; - bool myShowHighlight; }; #endif