X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_CreatePatternDlg.cxx;h=caa762e9e44c3ec923b28e4b262ee7a13f56e03a;hb=5309d564cb25bce0159bf722cd6347c06f7bc13f;hp=28bb9ad0c5e05707628d1398d5994fee150ab6d1;hpb=a2f0f70d5912ea83c868916f06eaefb58a32ec2e;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx index 28bb9ad0c..caa762e9e 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx @@ -42,8 +42,8 @@ #include "SUIT_FileDlg.h" #include "SalomeApp_Study.h" -#include "SalomeApp_DataOwner.h" -#include "SalomeApp_SelectionMgr.h" +#include "LightApp_DataOwner.h" +#include "LightApp_SelectionMgr.h" #include "SalomeApp_Tools.h" #include "SALOMEDS_SObject.hxx" @@ -88,9 +88,7 @@ SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI* theModule, : QDialog( SMESH::GetDesktop( theModule ), theName, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { setCaption(tr("CAPTION")); @@ -104,6 +102,9 @@ SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI* theModule, aDlgLay->setStretchFactor(aMainFrame, 1); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + mySelector = aViewWindow->GetSelector(); + Init(theType); } @@ -289,7 +290,7 @@ void SMESHGUI_CreatePatternDlg::SetMesh (SMESH::SMESH_Mesh_ptr thePtr) _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in()); //Handle(SALOME_InteractiveObject) anIObj = // new SALOME_InteractiveObject(aSobj->GetID().c_str(), "SMESH"); - SUIT_DataOwnerPtr anIObj (new SalomeApp_DataOwner(aSobj->GetID().c_str())); + SUIT_DataOwnerPtr anIObj (new LightApp_DataOwner(aSobj->GetID().c_str())); isValidMesh = mySelectionMgr->isOk(anIObj); } @@ -386,7 +387,8 @@ void SMESHGUI_CreatePatternDlg::onSave() tr("ERROR_OF_SAVING"), QMessageBox::Ok); } else { //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); @@ -435,7 +437,8 @@ void SMESHGUI_CreatePatternDlg::onOk() return; } else { //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); @@ -454,7 +457,8 @@ void SMESHGUI_CreatePatternDlg::onOk() //======================================================================= void SMESHGUI_CreatePatternDlg::onClose() { - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); @@ -577,10 +581,13 @@ void SMESHGUI_CreatePatternDlg::onDeactivate() //======================================================================= void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*) { - mySMESHGUI->EmitSignalDeactivateDialog(); - setEnabled(true); - activateSelection(); - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); + // there is a stange problem that enterEvent() comes after onSave() + if ( isVisible () ) { + mySMESHGUI->EmitSignalDeactivateDialog(); + setEnabled(true); + activateSelection(); + connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); + } } //================================================================================= @@ -682,7 +689,8 @@ void SMESHGUI_CreatePatternDlg::activateSelection() { mySelectionMgr->clearFilters(); //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); if (myType == Type_2d) { mySelectionMgr->installFilter(new SMESH_NumberFilter