From: vsv Date: Tue, 18 Jun 2019 13:10:57 +0000 (+0300) Subject: Issue #2929: Make possible enable/disable additional highlighting on mouse moving X-Git-Tag: VEDF2019Lot4~108 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d3b84f734fffb499aaf4ffca4f2637429aaf776d;p=modules%2Fshaper.git Issue #2929: Make possible enable/disable additional highlighting on mouse moving --- diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 8a961e01a..209e9542f 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -780,6 +780,14 @@ void SHAPERGUI::createPreferences() ModuleBase_Preferences::VIEWER_SECTION, "point-selection-sensitivity"); pref->addItem(tr("Edge"), sensitivityGroup, SUIT_PreferenceMgr::DblSpin, ModuleBase_Preferences::VIEWER_SECTION, "edge-selection-sensitivity"); + + int highlightGroup = pref->addItem(tr("Additional highlighting"), viewTab); + pref->setItemProperty("columns", 2, highlightGroup); + pref->addItem(tr("In 3d mode"), highlightGroup, + SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-3d"); + pref->addItem(tr("In 2d mode"), highlightGroup, + SUIT_PreferenceMgr::Bool, ModuleBase_Preferences::VIEWER_SECTION, "highlighting-2d"); + pref->retrieve(); } diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index 10abc5754..6a33fefb1 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -178,10 +178,10 @@ void XGUI_ViewerProxy::connectToViewer() this, SLOT(onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*))); connect(aViewer, SIGNAL(keyPress(ModuleBase_IViewWindow*, QKeyEvent*)), - this, SIGNAL(keyPress(ModuleBase_IViewWindow*, QKeyEvent*))); + this, SLOT(onKeyPress(ModuleBase_IViewWindow*, QKeyEvent*))); connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)), - this, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*))); + this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*))); connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); @@ -525,9 +525,38 @@ void XGUI_ViewerProxy::updateHighlight() #ifdef HAVE_SALOME void XGUI_ViewerProxy::onMouseMove(ModuleBase_IViewWindow* theWnd, QMouseEvent* theEvent) { - updateHighlight(); + if (myIs2dMode) { + bool aHighlight2d = + ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-2d", true); + if (aHighlight2d || myShowHighlight) + updateHighlight(); + else + eraseHighlight(); + } + else { + bool aHighlight3d = + ModuleBase_Preferences::resourceMgr()->booleanValue("Viewer", "highlighting-3d", false); + if (aHighlight3d || myShowHighlight) + updateHighlight(); + else + eraseHighlight(); + } emit mouseMove(theWnd, theEvent); } + +void XGUI_ViewerProxy::onKeyPress(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent) +{ + myShowHighlight = theEvent->key() == Qt::Key_H; + emit keyPress(theWnd, theEvent); +} + +void XGUI_ViewerProxy::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent) +{ + if (theEvent->key() == Qt::Key_H) { + myShowHighlight = false; + } + emit keyRelease(theWnd, theEvent); +} #endif //*************************************** diff --git a/src/XGUI/XGUI_ViewerProxy.h b/src/XGUI/XGUI_ViewerProxy.h index e250d0356..cf73432d8 100644 --- a/src/XGUI/XGUI_ViewerProxy.h +++ b/src/XGUI/XGUI_ViewerProxy.h @@ -155,6 +155,8 @@ private slots: void onViewTransformed(AppElements_ViewWindow::OperationType); #else void onMouseMove(ModuleBase_IViewWindow*, QMouseEvent*); + void onKeyPress(ModuleBase_IViewWindow*, QKeyEvent*); + void onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*); #endif private: