Salome HOME
Merge remote-tracking branch 'remotes/origin/BR_v14_rc' into BR_SHP_FORMAT
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ObjListBox.cxx
index f20715a645dc821e748bbf359ea14fe14f745ccb..8547e8faf5bdd543f7519a486fbae2541effabbb 100644 (file)
@@ -94,6 +94,7 @@ void HYDROGUI_ObjListBox::reset()
 {
   myList->clear();
   mySelection.Clear();
+  emit selectionChanged();
 }
 
 void HYDROGUI_ObjListBox::setSelectedObjects( const HYDROData_SequenceOfObjects& theObjects )
@@ -115,17 +116,15 @@ HYDROData_SequenceOfObjects HYDROGUI_ObjListBox::selectedObjects() const
 void HYDROGUI_ObjListBox::OnInclude()
 {
   Append( HYDROGUI_Tool::GetSelectedObjects( module() ) );
+  emit selectionChanged();
 }
 
 void HYDROGUI_ObjListBox::OnExclude()
 {
   QList<QListWidgetItem*> aSelection = myList->selectedItems();
   foreach( QListWidgetItem* anItem, aSelection )
-  {
-    int anIndex = myList->row( anItem );
-    myList->takeItem( anIndex );
-    mySelection.Remove( anIndex, anIndex );
-  }
+    delete anItem;
+  emit selectionChanged();
 }
 
 void HYDROGUI_ObjListBox::Append( const HYDROData_SequenceOfObjects& theObjects )
@@ -140,8 +139,11 @@ void HYDROGUI_ObjListBox::Append( const HYDROData_SequenceOfObjects& theObjects
     if( isOK )
     {
       QString aName = anObject->GetName();
-      myList->addItem( aName );
-      mySelection.Append( anObject );
+      if (myList->findItems(aName, Qt::MatchExactly).size() == 0)
+      {
+        myList->addItem( aName );
+        mySelection.Append( anObject );
+      }
     }
   }
 }