]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3180: Visual separation for features
authorvsv <vsv@opencascade.com>
Fri, 10 Apr 2020 16:30:57 +0000 (19:30 +0300)
committervsv <vsv@opencascade.com>
Fri, 10 Apr 2020 16:30:57 +0000 (19:30 +0300)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_TreeNodes.cpp
src/PartSet/PartSet_TreeNodes.h

index 1e8d2882fcf48db61638328c4d42444f4276c735..8dfec292f04d56fb463bed339aef3065c7424737 100644 (file)
 
 #include <SelectMgr_ListIteratorOfListOfFilter.hxx>
 
+#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");
index dcd74cf6c0090934100500dc2607fb03d2b3814c..ac694b1ab550c489cec167c9e907ae90e55556a0 100644 (file)
@@ -40,6 +40,8 @@
 #include <ModelAPI_Folder.h>
 #include <ModelAPI_AttributeReference.h>
 
+#include <Config_PropManager.h>
+
 #include <QBrush>
 #include <QMap>
 
@@ -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<int> 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<int> 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
index 9167859c1d0d0e2d6dceef3866df93890aa063a8..33cbb68083233c021e42637d04f73678b5435fd7 100644 (file)
@@ -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;
 };