From a15ceb1354447d9e1670895ac6414204df831f2b Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 10 Apr 2020 19:30:57 +0300 Subject: [PATCH] Issue #3180: Visual separation for features --- src/PartSet/PartSet_Module.cpp | 7 +++++++ src/PartSet/PartSet_TreeNodes.cpp | 18 ++++++++++++++++++ src/PartSet/PartSet_TreeNodes.h | 3 +++ 3 files changed, 28 insertions(+) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 1e8d2882f..8dfec292f 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) { @@ -251,6 +254,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 dcd74cf6c..ac694b1ab 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& theDo 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 9167859c1..33cbb6808 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; }; -- 2.39.2