Salome HOME
Edit Mesh/Sub-Mesh window has strange "half-active" view, if do Compute.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FilterDlg.cxx
index 9f1f1ceb6d6c2588130edadc687d9a4f8ad89b86..19e13e85d125b19c549f4da51b90df72a3755b9c 100755 (executable)
@@ -1797,13 +1797,13 @@ QFrame* SMESHGUI_FilterDlg::createButtonFrame (QWidget* theParent)
 {
   QGroupBox* aGrp = new QGroupBox(1, Qt::Vertical, theParent);
 
-  myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
-  myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
   myButtons[ BTN_OK    ] = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGrp);
+  myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
 
   QLabel* aLbl = new QLabel(aGrp);
   aLbl->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
 
+  myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
   myButtons[ BTN_Close  ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
   myButtons[ BTN_Help  ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp);
 
@@ -2189,9 +2189,13 @@ void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg)
 // name    : SMESHGUI_FilterDlg::SetGroupIds
 // Purpose : Set mesh
 //=======================================================================
-void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_ptr theMesh)
+void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh)
 {
   myMesh = theMesh;
+  if ( myMesh->_is_nil() ) {
+    myButtons[BTN_OK]->setEnabled(false);
+    myButtons[BTN_Apply]->setEnabled(false);
+  }
 }
 
 //=======================================================================
@@ -2526,6 +2530,14 @@ void SMESHGUI_FilterDlg::onSelectionDone()
   int aRow, aCol;
   const SALOME_ListIO& aList = mySelector->StoredIObjects();
 
+  if ( myMesh->_is_nil() && aList.Extent()>0 ) {
+    myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First());
+    if ( !(myMesh->_is_nil()) ) {
+      myButtons[BTN_OK]->setEnabled(true);
+      myButtons[BTN_Apply]->setEnabled(true);
+    }
+  }
+
   if (aList.Extent() != 1 ||
       !myTable->CurrentCell(aRow, aCol) ||
       myTable->GetCriterionType(aRow) != FT_BelongToGeom &&
@@ -2545,6 +2557,7 @@ void SMESHGUI_FilterDlg::onSelectionDone()
     }
 }
 
+
 //=======================================================================
 // name    : SMESHGUI_FilterDlg::onCriterionChanged
 // Purpose : SLOT called when cretarion of current row changed. Update selection