X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ViewerProxy.cpp;h=44cee80cdc980b62a20667d057bfe53febca0944;hb=9c54fb01877c455abb5b5ff22e384468f795b328;hp=ec70496183d244a53a2d071c79e4f23bf9f9f130;hpb=4f5cbc32b2621344e253876da67abc1ccd94fe31;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ViewerProxy.cpp b/src/XGUI/XGUI_ViewerProxy.cpp index ec7049618..44cee80cd 100644 --- a/src/XGUI/XGUI_ViewerProxy.cpp +++ b/src/XGUI/XGUI_ViewerProxy.cpp @@ -10,6 +10,8 @@ #include #include +#include + XGUI_ViewerProxy::XGUI_ViewerProxy(XGUI_Workshop* theParent) : ModuleBase_IViewer(theParent), myWorkshop(theParent) @@ -40,7 +42,7 @@ Handle(V3d_View) XGUI_ViewerProxy::activeView() const return myWorkshop->salomeConnector()->viewer()->activeView(); } else { AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); - return (aViewer->activeViewWindow()) ? aViewer->activeViewWindow()->viewPort()->getView() : + return (aViewer->activeViewWindow()) ? aViewer->activeViewWindow()->viewPortApp()->getView() : Handle(V3d_View)(); } } @@ -62,7 +64,7 @@ void XGUI_ViewerProxy::fitAll() } else { AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); if (aViewer->activeViewWindow()) - aViewer->activeViewWindow()->viewPort()->fitAll(); + aViewer->activeViewWindow()->viewPortApp()->fitAll(); } } @@ -79,7 +81,7 @@ void XGUI_ViewerProxy::connectToViewer() this, SIGNAL(deleteView(ModuleBase_IViewWindow*))); connect(aViewer, SIGNAL(viewCreated(ModuleBase_IViewWindow*)), - this, SIGNAL(viewCreated(ModuleBase_IViewWindow*))); + this, SLOT(onViewCreated(ModuleBase_IViewWindow*))); connect(aViewer, SIGNAL(activated(ModuleBase_IViewWindow*)), this, SIGNAL(activated(ModuleBase_IViewWindow*))); @@ -105,7 +107,6 @@ void XGUI_ViewerProxy::connectToViewer() connect(aViewer, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); connect(aViewer, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this, SIGNAL(contextMenuRequested(QContextMenuEvent*))); - } else { AppElements_Viewer* aViewer = myWorkshop->mainWindow()->viewer(); @@ -147,6 +148,16 @@ void XGUI_ViewerProxy::connectToViewer() } } +bool XGUI_ViewerProxy::eventFilter(QObject *theObject, QEvent *theEvent) +{ + if (theEvent->type() == QEvent::Enter) { + emit enterViewPort(); + } + else if (theEvent->type() == QEvent::Leave) { + emit leaveViewPort(); + } + return ModuleBase_IViewer::eventFilter(theObject, theEvent); +} void XGUI_ViewerProxy::onTryCloseView(AppElements_ViewWindow* theWnd) { @@ -158,8 +169,17 @@ void XGUI_ViewerProxy::onDeleteView(AppElements_ViewWindow* theWnd) emit deleteView(theWnd); } +void XGUI_ViewerProxy::onViewCreated(ModuleBase_IViewWindow* theWnd) +{ + theWnd->viewPort()->installEventFilter(this); + + emit viewCreated(theWnd); +} + void XGUI_ViewerProxy::onViewCreated(AppElements_ViewWindow* theWnd) { + theWnd->viewPort()->installEventFilter(this); + emit viewCreated(theWnd); } @@ -273,4 +293,4 @@ bool XGUI_ViewerProxy::canDragByMouse() const } else { return true; } -} \ No newline at end of file +}