Salome HOME
Merge from V6_main 13/12/2012
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_SelectionOp.cxx
index 7e4039a3aa647b3e142ffb9dd7b45e18529e20e9..2e4c7b9c5ecc67c0709784e8a6761ffb0afb39bb 100644 (file)
@@ -491,9 +491,16 @@ void SMESHGUI_SelectionOp::onTextChanged( int, const QStringList& list )
     IdList ids; extractIds( list, ids, '\0' );
     IdList::const_iterator anIt = ids.begin(),
                            aLast = ids.end();
-    for( ; anIt!=aLast; anIt++ )
-      if( const SMDS_MeshNode * n = aMesh->FindNode( *anIt ) )
-        newIndices.Add( n->GetID() );
+    if ( selectionMode() == NodeSelection )
+      for( ; anIt!=aLast; anIt++ ) {
+        if( const SMDS_MeshNode * n = aMesh->FindNode( *anIt ) )
+          newIndices.Add( n->GetID() );
+      }
+    else 
+      for( ; anIt!=aLast; anIt++ ) {
+        if( const SMDS_MeshElement* e = aMesh->FindElement( *anIt ) )
+          newIndices.Add( e->GetID() );
+      }
 
     selector()->AddOrRemoveIndex( sel.First(), newIndices, false );
     highlight( sel.First(), true, true );