]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3221: Visual separation for features
authorvsv <vsv@opencascade.com>
Fri, 10 Apr 2020 16:30:57 +0000 (19:30 +0300)
committerArtem Zhidkov <Artem.Zhidkov@opencascade.com>
Thu, 2 Jul 2020 11:25:13 +0000 (14:25 +0300)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_TreeNodes.cpp
src/PartSet/PartSet_TreeNodes.h

index 969ffe1ac6e102842bb06764c7f7572d159945b6..1be514700ac7cc10af53f3a77fffa625cc78f1eb 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)
 {
@@ -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");
index c63a5eb3a7fb4a7faec1681a457544a002a33d9b..c0400d6f74f356aa8abe83c655162f062a9b1b95 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& /*the
   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 ef4ae8f8223acb1390eddedc3db06ac08dbf56b8..e5f3599a112240dcb49cea7d4bba33b6503af1ea 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;
 };