-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// purpose :
//=================================================================================
SMESHGUI_PreviewDlg::SMESHGUI_PreviewDlg(SMESHGUI* theModule) :
- mySMESHGUI(theModule),
QDialog(SMESH::GetDesktop( theModule )),
+ mySMESHGUI(theModule),
myIsApplyAndClose( false )
{
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
+ connect(mySMESHGUI, SIGNAL(SignalCloseView()), this, SLOT(onCloseView()));
+ connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), this, SLOT(onOpenView()));
}
//=================================================================================
// purpose : Show preview in the viewer
//=================================================================================
void SMESHGUI_PreviewDlg::showPreview(){
- if(mySimulation)
+ if(mySimulation && mySimulation->GetActor())
mySimulation->SetVisibility(true);
}
// purpose : Hide preview in the viewer
//=================================================================================
void SMESHGUI_PreviewDlg::hidePreview(){
- if(mySimulation)
+ if(mySimulation && mySimulation->GetActor())
mySimulation->SetVisibility(false);
}
connect(myPreviewCheckBox, SIGNAL(toggled(bool)), this, SLOT(onDisplaySimulation(bool)));
}
-
//=================================================================================
// function : toDisplaySimulation
// purpose :
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 :
//=================================================================================
SMESHGUI_MultiPreviewDlg::SMESHGUI_MultiPreviewDlg( SMESHGUI* theModule ) :
- mySMESHGUI( theModule ),
QDialog( SMESH::GetDesktop( theModule ) ),
+ mySMESHGUI( theModule ),
myIsApplyAndClose( false )
{
+ mySimulationList.clear();
+ connect(mySMESHGUI, SIGNAL(SignalCloseView()), this, SLOT(onCloseView()));
}
//=================================================================================
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 );
}
//=================================================================================
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 );
}
//=================================================================================
connect( myPreviewCheckBox, SIGNAL( toggled( bool ) ), this, SLOT( onDisplaySimulation( bool ) ) );
}
-
//=================================================================================
// function : toDisplaySimulation
// purpose :
mySimulationList.clear();
for ( int i = 0; i < theMeshPreviewStruct.count(); i++ ) {
mySimulationList << new SMESHGUI_MeshEditPreview( SMESH::GetViewWindow( mySMESHGUI ) );
- mySimulationList[i]->SetData( theMeshPreviewStruct[i].operator->() );
+ mySimulationList[i]->SetData( theMeshPreviewStruct[i].in() );
}
}
+
+//=================================================================================
+// function : onCloseView()
+// purpose : SLOT called when close view
+//=================================================================================
+void SMESHGUI_MultiPreviewDlg::onCloseView()
+{
+ qDeleteAll( mySimulationList );
+ mySimulationList.clear();
+}