Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_OrderedListWidget.cxx
index a6ef3229b156335e7ff510b9012524bdf408058c..fe1cdce1dee59fee995ad9f55087b285b37a00b7 100644 (file)
@@ -112,12 +112,21 @@ HYDROGUI_OrderedListWidget::HYDROGUI_OrderedListWidget( QWidget* theParent, int
 
   connect ( myList->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), 
             this, SIGNAL( selectionChanged() ) );
+  
+  connect ( myList->selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), 
+            this, SLOT( onSelectionChanged() ) );
 
   // Initialize
   setHiddenObjectsShown( true );
   setVisibilityIconShown( true );
 }
 
+void HYDROGUI_OrderedListWidget::onSelectionChanged()
+{
+  QStringList selectedEntries = getSelectedEntries();
+
+}
+
 /**
   Destructor.
 */
@@ -145,6 +154,28 @@ void HYDROGUI_OrderedListWidget::setBackgroundColor (int theInd, QColor theColor
   }
 }
 
+void HYDROGUI_OrderedListWidget::setBackgroundColor (QString theName, QColor theColor)
+{
+  HYDROGUI_ListModel* aModel = getSourceModel();
+  if (aModel)
+  {
+    QList<Handle(HYDROData_Entity)> anObjects = aModel->getObjects();
+    int ind = -1;
+    int cur_ind = 0;
+    foreach (Handle(HYDROData_Entity) ent, anObjects)
+    {
+      if (ent->GetName() == theName)
+      {
+        ind = cur_ind;
+        break;
+      }
+      cur_ind++;
+    }
+    if (ind != -1)
+      aModel->setBackgroundColor( ind, theColor );
+  }
+}
+
 void HYDROGUI_OrderedListWidget::clearAllBackgroundColors ()
 {
   HYDROGUI_ListModel* aModel = getSourceModel();