Salome HOME
Merge branch 'BR_1328' into BR_DEMO
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ListModel.cxx
index 79f46d95572263bb60878daf54245948ae2a30c4..a452d2b3ba7145356f386adaf93f09285c28c6ca 100644 (file)
@@ -60,6 +60,24 @@ HYDROGUI_ListModel::~HYDROGUI_ListModel()
 {
 }
 
+void HYDROGUI_ListModel::setBackgroundColor(int theInd, QColor theColor)
+{
+  myColoredRow[theInd] = theColor;
+}
+
+void HYDROGUI_ListModel::clearAllBackgroundColors()
+{
+  myColoredRow.clear();
+}
+
+QColor HYDROGUI_ListModel::getBackgroundColor(int theInd) const
+{
+  if (myColoredRow.count( theInd ))
+    return myColoredRow[theInd];
+  else
+    return QColor();
+}
+
 /**
 */
 QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) const
@@ -79,6 +97,16 @@ QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) co
         return QVariant();
     }
     break;
+  case Qt::BackgroundRole:
+    {
+      if( aColumn==0 && aRow >=0 && aRow < myObjects.count() && myColoredRow.contains(aRow))
+      {
+        QBrush aBackgr(myColoredRow[aRow]);
+        return aBackgr;
+      }
+      else
+        return QVariant();
+    }
 
   case Qt::DecorationRole:
     {