X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_PreviewDlg.cxx;h=d466dedf32efe535dd17667d2ca2420039641735;hp=7710d161bcc0193ac82e0fa2b4ac782e2bf8ac31;hb=5c19bc1e1684ec6a466423361949ed7b60556968;hpb=b1b19cbc0122fe55a2eee6378627dd1454acbea1 diff --git a/src/SMESHGUI/SMESHGUI_PreviewDlg.cxx b/src/SMESHGUI/SMESHGUI_PreviewDlg.cxx index 7710d161b..d466dedf3 100644 --- a/src/SMESHGUI/SMESHGUI_PreviewDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_PreviewDlg.cxx @@ -50,6 +50,8 @@ SMESHGUI_PreviewDlg::SMESHGUI_PreviewDlg(SMESHGUI* theModule) : myIsApplyAndClose( false ) { mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); + connect(mySMESHGUI, SIGNAL(SignalCloseView()), this, SLOT(onCloseView())); + connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), this, SLOT(onOpenView())); } //================================================================================= @@ -66,7 +68,7 @@ SMESHGUI_PreviewDlg::~SMESHGUI_PreviewDlg() // purpose : Show preview in the viewer //================================================================================= void SMESHGUI_PreviewDlg::showPreview(){ - if(mySimulation) + if(mySimulation && mySimulation->GetActor()) mySimulation->SetVisibility(true); } @@ -75,7 +77,7 @@ void SMESHGUI_PreviewDlg::showPreview(){ // purpose : Hide preview in the viewer //================================================================================= void SMESHGUI_PreviewDlg::hidePreview(){ - if(mySimulation) + if(mySimulation && mySimulation->GetActor()) mySimulation->SetVisibility(false); } @@ -87,7 +89,6 @@ void SMESHGUI_PreviewDlg::connectPreviewControl(){ connect(myPreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool))); } - //================================================================================= // function : toDisplaySimulation // purpose : @@ -124,7 +125,27 @@ bool SMESHGUI_PreviewDlg::isApplyAndClose() const return myIsApplyAndClose; } +//================================================================================= +// function : onCloseView() +// purpose : SLOT called when close view +//================================================================================= +void SMESHGUI_PreviewDlg::onCloseView() +{ + if ( mySimulation && mySimulation->GetActor()) + mySimulation->SetVisibility(false); + delete mySimulation; + mySimulation=0; +} +//================================================================================= +// function : onOpenView() +// purpose : SLOT called when open view +//================================================================================= +void SMESHGUI_PreviewDlg::onOpenView() +{ + if ( !mySimulation) + mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI )); +} //================================================================================= // class : SMESHGUI_SMESHGUI_MultiPreviewDlg() // purpose : @@ -134,6 +155,8 @@ SMESHGUI_MultiPreviewDlg::SMESHGUI_MultiPreviewDlg( SMESHGUI* theModule ) : QDialog( SMESH::GetDesktop( theModule ) ), myIsApplyAndClose( false ) { + mySimulationList.clear(); + connect(mySMESHGUI, SIGNAL(SignalCloseView()), this, SLOT(onCloseView())); } //================================================================================= @@ -152,7 +175,8 @@ SMESHGUI_MultiPreviewDlg::~SMESHGUI_MultiPreviewDlg() void SMESHGUI_MultiPreviewDlg::showPreview() { for ( int i = 0; i < mySimulationList.count(); i++ ) - mySimulationList[i]->SetVisibility( true ); + if(mySimulationList[i] && mySimulationList[i]->GetActor()) + mySimulationList[i]->SetVisibility( true ); } //================================================================================= @@ -162,7 +186,8 @@ void SMESHGUI_MultiPreviewDlg::showPreview() void SMESHGUI_MultiPreviewDlg::hidePreview() { for ( int i = 0; i < mySimulationList.count(); i++ ) - mySimulationList[i]->SetVisibility( false ); + if(mySimulationList[i] && mySimulationList[i]->GetActor()) + mySimulationList[i]->SetVisibility( false ); } //================================================================================= @@ -174,7 +199,6 @@ void SMESHGUI_MultiPreviewDlg::connectPreviewControl() connect( myPreviewCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( onDisplaySimulation( bool ) ) ); } - //================================================================================= // function : toDisplaySimulation // purpose : @@ -227,3 +251,13 @@ void SMESHGUI_MultiPreviewDlg::setSimulationPreview( QListSetData( theMeshPreviewStruct[i].operator->() ); } } + +//================================================================================= +// function : onCloseView() +// purpose : SLOT called when close view +//================================================================================= +void SMESHGUI_MultiPreviewDlg::onCloseView() +{ + qDeleteAll( mySimulationList ); + mySimulationList.clear(); +}