From 12374ff5c533c0c60f8b779cf637cd2455a370a5 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 13 May 2014 19:35:49 +0400 Subject: [PATCH] Provided context menu event in view window --- src/XGUI/XGUI_ViewWindow.cpp | 12 +++++++----- src/XGUI/XGUI_ViewWindow.h | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/XGUI/XGUI_ViewWindow.cpp b/src/XGUI/XGUI_ViewWindow.cpp index 44b64c985..328b29306 100644 --- a/src/XGUI/XGUI_ViewWindow.cpp +++ b/src/XGUI/XGUI_ViewWindow.cpp @@ -295,7 +295,6 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType) connect(myViewPort, SIGNAL(vpUpdated()), this, SLOT(updateToolBar())); connect(this, SIGNAL(vpTransformationFinished(XGUI_ViewWindow::OperationType)), this, SLOT(updateToolBar())); - } //**************************************************************** @@ -677,6 +676,13 @@ void XGUI_ViewWindow::vpMousePressEvent(QMouseEvent* theEvent) l_mbPressEvent = new QMouseEvent( *theEvent );*/ } +//**************************************************************** +void XGUI_ViewWindow::contextMenuEvent(QContextMenuEvent* theEvent) +{ + QFrame::contextMenuEvent(theEvent); + emit contextMenuRequested(theEvent); +} + //**************************************************************** void XGUI_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) { @@ -693,10 +699,6 @@ void XGUI_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) } */ emit mouseReleased(this, theEvent); - if (theEvent->button() == Qt::RightButton && prevState == -1) { - QContextMenuEvent aEvent(QContextMenuEvent::Mouse, theEvent->pos(), theEvent->globalPos()); - emit contextMenuRequested(&aEvent); - } } break; case ROTATE: diff --git a/src/XGUI/XGUI_ViewWindow.h b/src/XGUI/XGUI_ViewWindow.h index 554eee47b..65c2ae273 100644 --- a/src/XGUI/XGUI_ViewWindow.h +++ b/src/XGUI/XGUI_ViewWindow.h @@ -195,6 +195,8 @@ protected: virtual void showEvent(QShowEvent* theEvent); + virtual void contextMenuEvent(QContextMenuEvent* theEvent); + private slots: void onClose(); void onMinimize(); -- 2.39.2