summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-05-26 17:22:13 +0200
committerkobewi <kobewi4e@gmail.com>2023-05-26 17:49:01 +0200
commit54be2522592f6c20675c145b0a3e9b4ffcae2e52 (patch)
tree3a87f0d77bbffaeee2c15aaa194b5cbffba1fbcc
parentd984ad64d440320e40e85dbcb79b8e9240f75493 (diff)
downloadredot-engine-54be2522592f6c20675c145b0a3e9b4ffcae2e52.tar.gz
Add indicator for StringName properties
-rw-r--r--editor/editor_properties.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 6d9baecf40..0484a2efc9 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -108,6 +108,13 @@ void EditorPropertyText::update_property() {
void EditorPropertyText::set_string_name(bool p_enabled) {
string_name = p_enabled;
+ if (p_enabled) {
+ Label *prefix = memnew(Label("&"));
+ prefix->set_tooltip_text("StringName");
+ prefix->set_mouse_filter(MOUSE_FILTER_STOP);
+ text->get_parent()->add_child(prefix);
+ text->get_parent()->move_child(prefix, 0);
+ }
}
void EditorPropertyText::set_secret(bool p_enabled) {
@@ -122,9 +129,13 @@ void EditorPropertyText::_bind_methods() {
}
EditorPropertyText::EditorPropertyText() {
+ HBoxContainer *hb = memnew(HBoxContainer);
+ add_child(hb);
+
text = memnew(LineEdit);
- add_child(text);
+ hb->add_child(text);
add_focusable(text);
+ text->set_h_size_flags(SIZE_EXPAND_FILL);
text->connect("text_changed", callable_mp(this, &EditorPropertyText::_text_changed));
text->connect("text_submitted", callable_mp(this, &EditorPropertyText::_text_submitted));
}