diff options
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r-- | editor/editor_inspector.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 1b4bec5eab..92ea162962 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2112,9 +2112,7 @@ EditorInspectorArray::EditorInspectorArray() { elements_vbox->add_theme_constant_override("separation", 0); vbox->add_child(elements_vbox); - add_button = memnew(Button); - add_button->set_text(TTR("Add Element")); - add_button->set_text_alignment(HORIZONTAL_ALIGNMENT_CENTER); + add_button = EditorInspector::create_inspector_action_button(TTR("Add Element")); add_button->connect("pressed", callable_mp(this, &EditorInspectorArray::_add_button_pressed)); vbox->add_child(add_button); @@ -2299,6 +2297,14 @@ void EditorInspector::cleanup_plugins() { inspector_plugin_count = 0; } +Button *EditorInspector::create_inspector_action_button(const String &p_text) { + Button *button = memnew(Button); + button->set_text(p_text); + button->set_theme_type_variation(SNAME("InspectorActionButton")); + button->set_h_size_flags(SIZE_SHRINK_CENTER); + return button; +} + void EditorInspector::set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; } @@ -2992,11 +2998,9 @@ void EditorInspector::update_tree() { } if (!hide_metadata) { - Button *add_md = memnew(Button); - add_md->set_text(TTR("Add Metadata")); - add_md->set_focus_mode(Control::FOCUS_NONE); - add_md->set_icon(get_theme_icon("Add", "EditorIcons")); - add_md->connect("pressed", callable_mp(this, &EditorInspector::_show_add_meta_dialog)); + Button *add_md = EditorInspector::create_inspector_action_button(TTR("Add Metadata")); + add_md->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); + add_md->connect(SNAME("pressed"), callable_mp(this, &EditorInspector::_show_add_meta_dialog)); main_vbox->add_child(add_md); } |