]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0020479: EDF 1116 GEOM: Create a group, "Add" button is inactive but "Select all...
authordmv <dmv@opencascade.com>
Thu, 8 Oct 2009 07:31:15 +0000 (07:31 +0000)
committerdmv <dmv@opencascade.com>
Thu, 8 Oct 2009 07:31:15 +0000 (07:31 +0000)
src/GroupGUI/GroupGUI_GroupDlg.cxx

index f1d034be5aa39cc0219f95b86725a455a86ef4ca..65daf0124a42277f08290598c5eb7097c9c25a6b 100644 (file)
@@ -614,47 +614,49 @@ void GroupGUI_GroupDlg::selectAllSubShapes()
     return;
 
   GEOM::ListOfLong_var aSubShapes;
-//   if ( !myPlaceCheckBox->isChecked() )
-  if ( subSelectionWay() == ALL_SUBSHAPES )
-  {
-    myIdList->clear();
-    GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-    aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false);
-
-    if ( !aShOp->IsDone() )
-      return;
-  }
-  else
-  {
-    aSubShapes = new GEOM::ListOfLong();
-    aSubShapes->length( myMain2InPlaceIndices.Extent() );
-    TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip( myMain2InPlaceIndices );
-    for ( int i = 0; m2ip.More(); i++, m2ip.Next() )
-      aSubShapes[ i ] = m2ip.Key();
-  }
-  bool isBlocked = myIdList->signalsBlocked();
-  myIdList->blockSignals( true );
-
-  for ( int i = 0, n = aSubShapes->length(); i < n; i++ ) {
-    CORBA::Long anIndex = aSubShapes[i];
-    if ( anIndex < 0 )
-      continue;
-
-    QListWidgetItem* anItem = 0;
-    QString text = QString( "%1" ).arg( anIndex );
-    if ( !myInPlaceObj->_is_nil() ) {
-      QList<QListWidgetItem*> found = myIdList->findItems( text, Qt::MatchExactly );
-      if ( found.count() ) anItem = found[0];
-    }
-    if ( !anItem ) {
-      anItem = new QListWidgetItem( text );
-      myIdList->addItem( anItem );
+  GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+  aSubShapes = aShOp->SubShapeAllIDs(myMainObj, getShapeType(), false);
+  if ( aSubShapes->length() > 0) {
+    //   if ( !myPlaceCheckBox->isChecked() )
+    if ( subSelectionWay() == ALL_SUBSHAPES )
+      {
+        myIdList->clear();
+        
+        if ( !aShOp->IsDone() )
+          return;
+      }
+    else
+      {
+        aSubShapes = new GEOM::ListOfLong();
+        aSubShapes->length( myMain2InPlaceIndices.Extent() );
+        TColStd_DataMapIteratorOfDataMapOfIntegerInteger m2ip( myMain2InPlaceIndices );
+        for ( int i = 0; m2ip.More(); i++, m2ip.Next() )
+          aSubShapes[ i ] = m2ip.Key();
+      }
+    bool isBlocked = myIdList->signalsBlocked();
+    myIdList->blockSignals( true );
+    
+    for ( int i = 0, n = aSubShapes->length(); i < n; i++ ) {
+      CORBA::Long anIndex = aSubShapes[i];
+      if ( anIndex < 0 )
+        continue;
+      
+      QListWidgetItem* anItem = 0;
+      QString text = QString( "%1" ).arg( anIndex );
+      if ( !myInPlaceObj->_is_nil() ) {
+        QList<QListWidgetItem*> found = myIdList->findItems( text, Qt::MatchExactly );
+        if ( found.count() ) anItem = found[0];
+      }
+      if ( !anItem ) {
+        anItem = new QListWidgetItem( text );
+        myIdList->addItem( anItem );
+      }
+      anItem->setSelected( true );
     }
-    anItem->setSelected( true );
-  }
 
-  myIdList->blockSignals( isBlocked );
-  highlightSubShapes();
+    myIdList->blockSignals( isBlocked );
+    highlightSubShapes();
+  }
 }
 
 //=================================================================================