Salome HOME
0022098: EDF 2036 SMESH: Create groups from none conected parts of a mesh
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupDlg.cxx
index 03ebc273151c28875f28c9e3f5530e38c877ec56..932a322995e43318573df86b7d9988b63bb41e96 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013  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
@@ -124,7 +124,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
                                       SMESH::SMESH_Mesh_ptr theMesh )
   : QDialog( SMESH::GetDesktop( theModule ) ),
     mySMESHGUI( theModule ),
-    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myStoredShownEntity(0),
     mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
     myIsBusy( false ),
     myNameChanged( false ),
@@ -152,7 +152,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
                                       const bool theIsConvert )
   : QDialog( SMESH::GetDesktop( theModule ) ),
     mySMESHGUI( theModule ),
-    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+    mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myStoredShownEntity(0),
     mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
     myIsBusy( false ),
     myNameChanged( false ),
@@ -439,7 +439,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
 
   connect(myOKBtn,         SIGNAL(clicked()), this, SLOT(onOK()));
   connect(myApplyBtn,      SIGNAL(clicked()), this, SLOT(onApply()));
-  connect(myCloseBtn,      SIGNAL(clicked()), this, SLOT(onClose()));
+  connect(myCloseBtn,      SIGNAL(clicked()), this, SLOT(reject()));
   connect(myHelpBtn,       SIGNAL(clicked()), this, SLOT(onHelp()));
 
   /* Init selection */
@@ -458,7 +458,7 @@ void SMESHGUI_GroupDlg::initDialog( bool create)
   myGeomFilter = new GEOM_SelectionFilter( aStudy, true );
 
   connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
-  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()),        this, SLOT(onClose()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()),        this, SLOT(reject()));
   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()),  this, SLOT(onObjectSelectionChanged()));
   connect(mySMESHGUI, SIGNAL(SignalVisibilityChanged()),      this, SLOT(onVisibilityChanged()));
 
@@ -1189,7 +1189,7 @@ void SMESHGUI_GroupDlg::onOK()
 {
   setIsApplyAndClose( true );
   if ( onApply() )
-    onClose();
+    reject();
   setIsApplyAndClose( false );
 }
 
@@ -1560,7 +1560,7 @@ void SMESHGUI_GroupDlg::onSelectAll()
 
   myElementsLab->setEnabled( !noElemsModif );
   myElements->setEnabled   ( !noElemsModif );
-  myFilterBtn->setEnabled  ( !mySelectAll->isChecked() );
+  myFilterBtn->setEnabled  ( !noElemsModif );
   myAddBtn->setEnabled     ( !noElemsModif );
   myRemoveBtn->setEnabled  ( !noElemsModif );
   mySortBtn->setEnabled    ( !noElemsModif );
@@ -1725,8 +1725,8 @@ void SMESHGUI_GroupDlg::setFilters()
     myFilterDlg->Init( aType );
   }
 
-  myFilterDlg->SetSelection();
   myFilterDlg->SetMesh( myMesh );
+  myFilterDlg->SetSelection();
   myFilterDlg->SetSourceWg( myElements, false );
 
   myFilterDlg->show();
@@ -2165,15 +2165,6 @@ void SMESHGUI_GroupDlg::onSort()
   }
 }
 
-//=================================================================================
-// function : closeEvent()
-// purpose  :
-//=================================================================================
-void SMESHGUI_GroupDlg::closeEvent (QCloseEvent*)
-{
-  onClose();
-}
-
 //=================================================================================
 // function : onVisibilityChanged()
 // purpose  :
@@ -2184,10 +2175,10 @@ void SMESHGUI_GroupDlg::onVisibilityChanged()
 }
 
 //=================================================================================
-// function : SMESHGUI_GroupDlg::onClose
+// function : SMESHGUI_GroupDlg::reject
 // purpose  : SLOT called when "Close" button pressed. Close dialog
 //=================================================================================
-void SMESHGUI_GroupDlg::onClose()
+void SMESHGUI_GroupDlg::reject()
 {
   if (SMESH::GetCurrentVtkView()) {
     SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
@@ -2208,7 +2199,7 @@ void SMESHGUI_GroupDlg::onClose()
   mySelectionMgr->clearFilters();
   mySMESHGUI->ResetState();
 
-  reject();
+  QDialog::reject();
 }
 
 //=================================================================================
@@ -2262,16 +2253,6 @@ void SMESHGUI_GroupDlg::enterEvent (QEvent*)
   }
 }
 
-//=================================================================================
-// function : hideEvent
-// purpose  : caused by ESC key
-//=================================================================================
-void SMESHGUI_GroupDlg::hideEvent (QHideEvent*)
-{
-  if (!isMinimized() && !myIsBusy)
-    onClose();
-}
-
 //=================================================================================
 // function : keyPressEvent()
 // purpose  :