#include <HYDROGUI_ObjListBox.h>
#include <HYDROGUI_ObjComboBox.h>
-#include <HYDROGUI_Tool.h>
+#include <HYDROGUI_Tool2.h>
#include <QGridLayout>
#include <QListWidget>
#include <QLabel>
QList<QListWidgetItem*> aSelection = myList->selectedItems();
foreach( QListWidgetItem* anItem, aSelection )
{
- int anIndex = myList->row( anItem );
- myList->takeItem( anIndex );
- mySelection.Remove( anIndex, anIndex );
+ QString itemText = anItem->text();
+ for (int i=mySelection.Lower();i<=mySelection.Upper();i++)
+ {
+ QString name = mySelection(i)->GetName();
+ if (itemText == name)
+ {
+ mySelection.Remove(i);
+ break;
+ }
+ }
+ delete anItem;
}
emit selectionChanged();
}
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 );
+ }
}
}
}