From: vsv Date: Fri, 10 Apr 2020 16:30:57 +0000 (+0300) Subject: Issue #3221: Visual separation for features X-Git-Tag: V9_6_0a1~79 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e57c514b002b674bd7a61f5da1d98c9139779736;p=modules%2Fshaper.git Issue #3221: Visual separation for features --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 969ffe1ac..1be514700 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -146,6 +146,9 @@ #include +#define FEATURE_ITEM_COLOR "0,0,225" + + /*!Create and return new instance of XGUI_Module*/ extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop) { @@ -248,6 +251,10 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop) "Dimension color", Config_Prop::Color, SKETCH_DIMENSION_COLOR); + Config_PropManager::registerProp("Visualization", "feature_objectbrowser_color", + "Feature items in Object Browser", + Config_Prop::Color, FEATURE_ITEM_COLOR); + Config_PropManager::registerProp("Shortcuts", "add_parameter_shortcut", "Add parameter in parameters manager dialog", Config_Prop::Shortcut, "Ctrl+A"); diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index c63a5eb3a..c0400d6f7 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -40,6 +40,8 @@ #include #include +#include + #include #include @@ -129,6 +131,13 @@ QVariant PartSet_ObjectNode::data(int theColumn, int theRole) const else return QIcon(); } + case Qt::ForegroundRole: + if (myObject->groupName() == ModelAPI_Feature::group()) { + 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); } @@ -1199,7 +1208,16 @@ QTreeNodesList PartSet_ObjectFolderNode::objectsDeleted(const DocumentPtr& /*the return aResult; } +QVariant PartSet_ObjectFolderNode::data(int theColumn, int theRole) const +{ + if (theRole == Qt::ForegroundRole) { + std::vector aColor = + Config_PropManager::color("Visualization", "feature_objectbrowser_color"); + return QColor(aColor[0], aColor[1], aColor[2]); + } + return PartSet_ObjectNode::data(theColumn, theRole); +} ////////////////////////////////////////////////////////////////////////////////// QVariant PartSet_StepNode::data(int theColumn, int theRole) const diff --git a/src/PartSet/PartSet_TreeNodes.h b/src/PartSet/PartSet_TreeNodes.h index ef4ae8f82..e5f3599a1 100644 --- a/src/PartSet/PartSet_TreeNodes.h +++ b/src/PartSet/PartSet_TreeNodes.h @@ -325,6 +325,9 @@ public: /// \param theDoc a document where objects were deleted /// \param theGroup a name of group where objects were deleted virtual QTreeNodesList objectsDeleted(const DocumentPtr& theDoc, const QString& theGroup); + + /// Returns the node representation according to theRole. + virtual QVariant data(int theColumn, int theRole) const; };