]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3221: Set disabled color of features in a non-active part
authorvsv <vsv@opencascade.com>
Wed, 29 Jul 2020 08:00:06 +0000 (11:00 +0300)
committervsv <vsv@opencascade.com>
Wed, 29 Jul 2020 08:00:06 +0000 (11:00 +0300)
src/PartSet/PartSet_TreeNodes.cpp
src/PartSet/PartSet_TreeNodes.h

index 3bbc61c4994695d6bd2a0816c56c7e3ccb1a3ca4..ef099a03057cd51be209e37566d9b4ee81c81dac 100644 (file)
@@ -87,11 +87,16 @@ QVariant PartSet_TreeNode::data(int theColumn, int theRole) const
       return QBrush(DISABLED_COLOR);
     if (!aFlags.testFlag(Qt::ItemIsEditable))
       return QBrush(SELECTABLE_COLOR);
-    return ACTIVE_COLOR;
+    return activeItemColor();
   }
   return ModuleBase_ITreeNode::data(theColumn, theRole);
 }
 
+QColor PartSet_TreeNode::activeItemColor() const
+{
+  return ACTIVE_COLOR;
+}
+
 
 //////////////////////////////////////////////////////////////////////////////////
 QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const
@@ -131,19 +136,21 @@ QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const
       else
         return QIcon();
     }
-  case Qt::ForegroundRole:
-    if (myObject->groupName() == ModelAPI_Feature::group()) {
-      if (myObject->isDisabled())
-        return PartSet_TreeNode::data(theColumn, theRole);
-      std::vector<int> aColor =
-        Config_PropManager::color("Visualization", "feature_objectbrowser_color");
-      return QColor(aColor[0], aColor[1], aColor[2]);
-    }
-    break;
   }
   return PartSet_TreeNode::data(theColumn, theRole);
 }
 
+QColor PartSet_ObjectNode::activeItemColor() const
+{
+  if (myObject.get() && myObject->groupName() == ModelAPI_Feature::group()) {
+    std::vector<int> aColor =
+      Config_PropManager::color("Visualization", "feature_objectbrowser_color");
+    return QColor(aColor[0], aColor[1], aColor[2]);
+  }
+  return PartSet_TreeNode::activeItemColor();
+}
+
+
 Qt::ItemFlags PartSet_ObjectNode::flags(int theColumn) const
 {
   if (myObject->isDisabled()) {
index e5f3599a112240dcb49cea7d4bba33b6503af1ea..e032c27496b75d50f79ffb1b1960b11195a8de2d 100644 (file)
@@ -37,6 +37,9 @@ public:
 
   /// Returns the node representation according to theRole.
   virtual QVariant data(int theColumn, int theRole) const;
+
+  // Returns color of the Item when it is active
+  virtual QColor activeItemColor() const;
 };
 
 /**
@@ -90,6 +93,9 @@ public:
 
   virtual ObjectPtr subObject(int theId) const;
 
+  // Returns color of the Item when it is active
+  virtual QColor activeItemColor() const;
+
 protected:
   ObjectPtr myObject;
 };