From ba030237b7cb37ff434312838660e83fb590e862 Mon Sep 17 00:00:00 2001
From: Syres916 <46537884+Syres916@users.noreply.github.com>
Date: Fri, 13 Feb 2026 17:56:20 +0000
Subject: [PATCH] [Gui] Ensure Read Only Booleans in PropertyEditor are shown
using Disabled Text Color (#27429)
* Ensure read only Booleans are shown using Disabled Text color
* Make the disabled text color a more significant contrast to enabled
* Ensure correct contrasting color for Axis letters versus background color for both Light and Dark themes
---
src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg | 1 +
src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg | 1 +
src/Gui/Stylesheets/parameters/FreeCAD Dark.yaml | 2 +-
src/Gui/propertyeditor/PropertyItemDelegate.cpp | 7 ++++++-
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg
index 3bd3e35e9e..61a1f7a3c7 100644
--- a/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg
+++ b/src/Gui/PreferencePacks/FreeCAD Dark/FreeCAD Dark.cfg
@@ -117,6 +117,7 @@
+
diff --git a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg
index a67328d221..e6a4b3d79d 100644
--- a/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg
+++ b/src/Gui/PreferencePacks/FreeCAD Light/FreeCAD Light.cfg
@@ -130,6 +130,7 @@
+
diff --git a/src/Gui/Stylesheets/parameters/FreeCAD Dark.yaml b/src/Gui/Stylesheets/parameters/FreeCAD Dark.yaml
index c287db2fbe..51d7e9f412 100644
--- a/src/Gui/Stylesheets/parameters/FreeCAD Dark.yaml
+++ b/src/Gui/Stylesheets/parameters/FreeCAD Dark.yaml
@@ -53,7 +53,7 @@ StylesheetIconsColor: "white"
TabbarBackgroundColor: "@PrimaryColorDarken5"
InActiveTabBackgroundColor: "@PrimaryColorDarken2"
ActiveTabBackgroundColor: "@3DViewBackgroundRefColor"
-TextDisabledColor: "darken(@TextForegroundColor,40)"
+TextDisabledColor: "darken(@TextForegroundColor,120)"
TextEditFieldBackgroundColor: "@PrimaryColor"
TextForegroundColor: "#ffffff"
TextSelectBackgroundColor: "darken(@AccentColor,100)"
diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.cpp b/src/Gui/propertyeditor/PropertyItemDelegate.cpp
index 1edd578b19..d514b95387 100644
--- a/src/Gui/propertyeditor/PropertyItemDelegate.cpp
+++ b/src/Gui/propertyeditor/PropertyItemDelegate.cpp
@@ -148,7 +148,12 @@ void PropertyItemDelegate::paint(
option.rect.right() - (checkboxOption.rect.right() + spacing),
checkboxOption.rect.height()
);
- painter->setPen(palette.color(QPalette::Text));
+ if (readonly) {
+ painter->setPen(palette.color(QPalette::Disabled, QPalette::Text));
+ }
+ else {
+ painter->setPen(palette.color(QPalette::Text));
+ }
painter->drawText(textRect, Qt::AlignVCenter | Qt::AlignLeft, labelText);
}
else {