Skip to content

Commit 3726123

Browse files
committed
Change color of label for editor string properties
1 parent 56a2b14 commit 3726123

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

editor/editor_properties.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void EditorPropertyText::update_property() {
112112
void EditorPropertyText::set_string_name(bool p_enabled) {
113113
string_name = p_enabled;
114114
if (p_enabled) {
115-
Label *prefix = memnew(Label("&"));
115+
prefix = memnew(Label("&"));
116116
prefix->set_tooltip_text("StringName");
117117
prefix->set_mouse_filter(MOUSE_FILTER_STOP);
118118
text->get_parent()->add_child(prefix);
@@ -128,6 +128,17 @@ void EditorPropertyText::set_placeholder(const String &p_string) {
128128
text->set_placeholder(p_string);
129129
}
130130

131+
void EditorPropertyText::_notification(int p_what) {
132+
switch (p_what) {
133+
case NOTIFICATION_THEME_CHANGED: {
134+
if (prefix) {
135+
Color font_color = get_theme_color(SNAME("disabled_font_color"), EditorStringName(Editor));
136+
prefix->set_modulate(font_color);
137+
}
138+
} break;
139+
}
140+
}
141+
131142
void EditorPropertyText::_bind_methods() {
132143
}
133144

editor/editor_properties.h

+3
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,16 @@ class EditorPropertyText : public EditorProperty {
5959
GDCLASS(EditorPropertyText, EditorProperty);
6060
LineEdit *text = nullptr;
6161

62+
Label *prefix = nullptr;
63+
6264
bool updating = false;
6365
bool string_name = false;
6466
void _text_changed(const String &p_string);
6567
void _text_submitted(const String &p_string);
6668

6769
protected:
6870
virtual void _set_read_only(bool p_read_only) override;
71+
void _notification(int p_what);
6972
static void _bind_methods();
7073

7174
public:

0 commit comments

Comments
 (0)