Skip to content

Commit 2210111

Browse files
committed
Merge pull request #77521 from KoBeWi/to_StringName_or_not_to_StringName
Add indicator for StringName properties
2 parents 8267dbb + 54be252 commit 2210111

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

editor/editor_properties.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ void EditorPropertyText::update_property() {
108108

109109
void EditorPropertyText::set_string_name(bool p_enabled) {
110110
string_name = p_enabled;
111+
if (p_enabled) {
112+
Label *prefix = memnew(Label("&"));
113+
prefix->set_tooltip_text("StringName");
114+
prefix->set_mouse_filter(MOUSE_FILTER_STOP);
115+
text->get_parent()->add_child(prefix);
116+
text->get_parent()->move_child(prefix, 0);
117+
}
111118
}
112119

113120
void EditorPropertyText::set_secret(bool p_enabled) {
@@ -122,9 +129,13 @@ void EditorPropertyText::_bind_methods() {
122129
}
123130

124131
EditorPropertyText::EditorPropertyText() {
132+
HBoxContainer *hb = memnew(HBoxContainer);
133+
add_child(hb);
134+
125135
text = memnew(LineEdit);
126-
add_child(text);
136+
hb->add_child(text);
127137
add_focusable(text);
138+
text->set_h_size_flags(SIZE_EXPAND_FILL);
128139
text->connect("text_changed", callable_mp(this, &EditorPropertyText::_text_changed));
129140
text->connect("text_submitted", callable_mp(this, &EditorPropertyText::_text_submitted));
130141
}

0 commit comments

Comments
 (0)