Salome HOME
Updated copyright comment
[modules/shaper.git] / src / PartSet / PartSet_TreeNodes.cpp
index dab8161792d418f6694d4951da9faea858ae1b52..54dc64c1052326b70af7e1d41b22e45f8bfa4dd6 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -44,6 +44,7 @@
 
 #include <QBrush>
 #include <QMap>
+#include <QPalette>
 
 
 #define ACTIVE_COLOR QColor(Qt::black)
@@ -94,7 +95,11 @@ QVariant PartSet_TreeNode::data(int theColumn, int theRole) const
 
 QColor PartSet_TreeNode::activeItemColor() const
 {
-  return ACTIVE_COLOR;
+  // instead of ACTIVE_COLOR (black),
+  // use the color text of the current theme (white or black or other)
+  // to make it readable in dark theme (and light theme as well)
+  QColor color = QPalette().text().color() ;
+  return color;
 }
 
 
@@ -158,6 +163,17 @@ Qt::ItemFlags PartSet_ObjectNode::flags(int theColumn) const
   } else {
     DocumentPtr aDoc = myObject->document();
     SessionPtr aSession = ModelAPI_Session::get();
+
+    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(myObject);
+    if (aFeature.get() && aFeature->getKind() == "Group")
+    {
+      std::shared_ptr<ModelAPI_CompositeFeature> anOwner =
+        ModelAPI_Tools::compositeOwner (aFeature);
+
+      if (anOwner.get() && anOwner->getKind() == "ImportResult")
+        return aDefaultFlag;
+    }
+
     if (aSession->activeDocument() == aDoc)
       return aEditingFlag;
   }