From: vsv Date: Wed, 29 Jul 2020 08:00:06 +0000 (+0300) Subject: Issue #3221: Set disabled color of features in a non-active part X-Git-Tag: V9_6_0a1~33 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=03bb26a5da0a13a3adec6d6336c9c729166c2034;p=modules%2Fshaper.git Issue #3221: Set disabled color of features in a non-active part --- diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index 3bbc61c49..ef099a030 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -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 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 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()) { diff --git a/src/PartSet/PartSet_TreeNodes.h b/src/PartSet/PartSet_TreeNodes.h index e5f3599a1..e032c2749 100644 --- a/src/PartSet/PartSet_TreeNodes.h +++ b/src/PartSet/PartSet_TreeNodes.h @@ -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; };