From: nds Date: Thu, 28 Nov 2013 14:50:45 +0000 (+0000) Subject: Set 2d mode for OCC viewer. X-Git-Tag: issue_132_11_28~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2e8638b48abbc8f106cbed3c054c35be1e9b8639;p=modules%2Fhydro.git Set 2d mode for OCC viewer. --- diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.cxx b/src/HYDROCurveCreator/CurveCreator_Widget.cxx index 7c0b180e..fb6f53a3 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Widget.cxx @@ -237,6 +237,8 @@ void CurveCreator_Widget::setOCCViewer( OCCViewer_Viewer* theViewer ) this, SLOT( onMouseRelease( SUIT_ViewWindow*, QMouseEvent* ) ) ); disconnect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ), this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) ); + disconnect( aViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), + this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) ); // restore normal mode in the viewer OCCViewer_Utilities::setViewer2DMode( myOCCViewer, OCCViewer_ViewWindow::No2dMode ); // all local contexts should be closed if the viewer is not more used @@ -253,6 +255,8 @@ void CurveCreator_Widget::setOCCViewer( OCCViewer_Viewer* theViewer ) this, SLOT( onMouseRelease( SUIT_ViewWindow*, QMouseEvent* ) ) ); connect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ), this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) ); + connect( aViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), + this, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) ); OCCViewer_Utilities::setViewer2DMode( theViewer, OCCViewer_ViewWindow::XYPlane ); } } @@ -910,10 +914,11 @@ void CurveCreator_Widget::onGetCoordsByClick( QMouseEvent* pe ) } } -//================================================================================= -// function : CurveCreator_Widget::onMousePress() -// purpose : Manage mouse press events in Modification mode -//================================================================================= +/** + * Manage mouse press events + * \param theWindow an owner of the signal + * \param theEvent a mouse event + */ void CurveCreator_Widget::onMousePress( SUIT_ViewWindow*, QMouseEvent* theEvent ) { if ( theEvent->button() != Qt::LeftButton ) @@ -934,10 +939,11 @@ void CurveCreator_Widget::onMousePress( SUIT_ViewWindow*, QMouseEvent* theEvent } } -//================================================================================= -// function : HYDROGUI_PolylineOp::onMouseRelease() -// purpose : Manage mouse press events in Modification mode -//================================================================================= +/** + * Manage mouse release events in Modification mode + * \param theWindow an owner of the signal + * \param theEvent a mouse event + */ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow*, QMouseEvent* theEvent ) { if ( getActionMode() != ModificationMode ) @@ -955,10 +961,11 @@ void CurveCreator_Widget::onMouseRelease( SUIT_ViewWindow*, QMouseEvent* theEven updateLocalPointView(); } -//================================================================================= -// function : GeometryGUI::onMouseMove() -// purpose : Manage mouse move events in Modification mode -//================================================================================= +/** + * Manage mouse move events in Modification mode + * \param theWindow an owner of the signal + * \param theEvent a mouse event + */ void CurveCreator_Widget::onMouseMove( SUIT_ViewWindow*, QMouseEvent* theEvent ) { if ( getActionMode() != ModificationMode || !myDragStarted ) @@ -972,6 +979,15 @@ void CurveCreator_Widget::onMouseMove( SUIT_ViewWindow*, QMouseEvent* theEvent ) myDragStartPosition = aPos; } +/** + * Set zero viewer by the last view closed in + * \param theManager a viewer manager + */ +void CurveCreator_Widget::onLastViewClosed( SUIT_ViewManager* theManager ) +{ + myOCCViewer = 0; +} + void CurveCreator_Widget::onCellChanged( int theRow, int theColumn ) { int aCurrSect = getSectionId( theRow ); diff --git a/src/HYDROCurveCreator/CurveCreator_Widget.h b/src/HYDROCurveCreator/CurveCreator_Widget.h index 225e864d..72b3d64a 100644 --- a/src/HYDROCurveCreator/CurveCreator_Widget.h +++ b/src/HYDROCurveCreator/CurveCreator_Widget.h @@ -55,8 +55,6 @@ public: void setOCCViewer( OCCViewer_Viewer* theViewer ); OCCViewer_Viewer* getOCCViewer(); - //virtual bool eventFilter( QObject* theWatched, QEvent* theEvent ); - //! Return unique section name std::string getUniqSectionName(CurveCreator_ICurve* theCurve) const; @@ -104,6 +102,7 @@ protected slots: void onMousePress( SUIT_ViewWindow*, QMouseEvent* theEvent ); void onMouseRelease( SUIT_ViewWindow*, QMouseEvent* theEvent ); void onMouseMove( SUIT_ViewWindow*, QMouseEvent* theEvent ); + void onLastViewClosed( SUIT_ViewManager* theManager ); void onCellChanged( int theRow, int theColumn );