From fc7cdd5c37527f7ad6afb96d7d38861b26bfe5f1 Mon Sep 17 00:00:00 2001 From: kobewi Date: Mon, 11 Dec 2023 22:21:27 +0100 Subject: [PATCH] Disable Add button when theme item name is empty --- editor/plugins/theme_editor_plugin.cpp | 9 +++++++++ editor/plugins/theme_editor_plugin.h | 1 + 2 files changed, 10 insertions(+) diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 9ea0a03e684..6c153f61133 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -2287,8 +2287,11 @@ VBoxContainer *ThemeTypeEditor::_create_item_list(Theme::DataType p_data_type) { item_add_edit->connect("text_submitted", callable_mp(this, &ThemeTypeEditor::_item_add_lineedit_cbk).bind(p_data_type, item_add_edit)); Button *item_add_button = memnew(Button); item_add_button->set_text(TTR("Add")); + item_add_button->set_disabled(true); item_add_hb->add_child(item_add_button); item_add_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_add_cbk).bind(p_data_type, item_add_edit)); + item_add_edit->set_meta("button", item_add_button); + item_add_edit->connect("text_changed", callable_mp(this, &ThemeTypeEditor::_update_add_button).bind(item_add_edit)); return items_list; } @@ -2850,6 +2853,11 @@ void ThemeTypeEditor::_add_default_type_items() { ur->commit_action(); } +void ThemeTypeEditor::_update_add_button(const String &p_text, LineEdit *p_for_edit) { + Button *button = Object::cast_to