Salome HOME
Make the text of the data of the object browser readable in dark theme. cbr/make_object_browser_readable_in_dark_theme
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Thu, 27 Apr 2023 17:28:26 +0000 (19:28 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Tue, 9 May 2023 08:16:00 +0000 (10:16 +0200)
Don't hard code black, but use the same text color as the current theme

src/PartSet/PartSet_TreeNodes.cpp

index 9164dbc3d81243ade98c2d47655c1bfd96c89f1c..e01af5f18001f36ed9b762cd78a1326da770691f 100644 (file)
@@ -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;
 }