You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-17 14:11:06 +00:00
Add clear text button to LineEdit
- Add pressed state to clear button - Enable clear button on all inputs with search icon - Remove duplicate clear buttons - Fix rendering of icon for center and right alignments - Add clear button to more search fields - Add clear icon to default theme - Add method to control enabled state of clear button - Add property to enable clear button from inspector
This commit is contained in:
@@ -81,7 +81,8 @@ void ProjectSettingsEditor::_notification(int p_what) {
|
||||
globals_editor->edit(ProjectSettings::get_singleton());
|
||||
|
||||
search_button->set_icon(get_icon("Search", "EditorIcons"));
|
||||
clear_button->set_icon(get_icon("Close", "EditorIcons"));
|
||||
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
|
||||
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
|
||||
@@ -119,7 +120,8 @@ void ProjectSettingsEditor::_notification(int p_what) {
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
search_button->set_icon(get_icon("Search", "EditorIcons"));
|
||||
clear_button->set_icon(get_icon("Close", "EditorIcons"));
|
||||
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
|
||||
search_box->set_clear_button_enabled(true);
|
||||
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), get_icon("Keyboard", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), get_icon("JoyButton", "EditorIcons"));
|
||||
@@ -1591,15 +1593,6 @@ void ProjectSettingsEditor::_toggle_search_bar(bool p_pressed) {
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::_clear_search_box() {
|
||||
|
||||
if (search_box->get_text() == "")
|
||||
return;
|
||||
|
||||
search_box->clear();
|
||||
globals_editor->get_inspector()->update_tree();
|
||||
}
|
||||
|
||||
void ProjectSettingsEditor::set_plugins_page() {
|
||||
|
||||
tab_container->set_current_tab(plugin_settings->get_index());
|
||||
@@ -1662,7 +1655,6 @@ void ProjectSettingsEditor::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_translation_filter_option_changed"), &ProjectSettingsEditor::_translation_filter_option_changed);
|
||||
ClassDB::bind_method(D_METHOD("_translation_filter_mode_changed"), &ProjectSettingsEditor::_translation_filter_mode_changed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_clear_search_box"), &ProjectSettingsEditor::_clear_search_box);
|
||||
ClassDB::bind_method(D_METHOD("_toggle_search_bar"), &ProjectSettingsEditor::_toggle_search_bar);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_copy_to_platform_about_to_show"), &ProjectSettingsEditor::_copy_to_platform_about_to_show);
|
||||
@@ -1753,10 +1745,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
||||
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
search_bar->add_child(search_box);
|
||||
|
||||
clear_button = memnew(ToolButton);
|
||||
search_bar->add_child(clear_button);
|
||||
clear_button->connect("pressed", this, "_clear_search_box");
|
||||
|
||||
globals_editor = memnew(SectionedInspector);
|
||||
props_base->add_child(globals_editor);
|
||||
globals_editor->get_inspector()->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
|
||||
|
||||
Reference in New Issue
Block a user