diff --git a/doc/classes/TabBar.xml b/doc/classes/TabBar.xml index 698de783c0e..420ab2adebf 100644 --- a/doc/classes/TabBar.xml +++ b/doc/classes/TabBar.xml @@ -223,7 +223,7 @@ If [code]true[/code], enables selecting a tab with the right mouse button. - + Sets the position at which tabs will be placed. See [enum AlignmentMode] for details. diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml index bdc73ee3c4b..ec2be012e9f 100644 --- a/doc/classes/TabContainer.xml +++ b/doc/classes/TabContainer.xml @@ -138,7 +138,7 @@ If [code]true[/code], tabs can be rearranged with mouse drag. - + Sets the position at which tabs will be placed. See [enum TabBar.AlignmentMode] for details. diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index aab9743c43d..ea51e1f399b 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -611,7 +611,6 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() { add_child(main_vbox); tab_container = memnew(TabContainer); - tab_container->set_tab_alignment(TabBar::ALIGNMENT_LEFT); tab_container->set_use_hidden_tabs_for_min_size(true); tab_container->set_v_size_flags(Control::SIZE_EXPAND_FILL); tab_container->connect("tab_selected", callable_mp(this, &InputEventConfigurationDialog::_tab_selected)); diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 1a7b11d888b..d294858ff8f 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -61,7 +61,6 @@ EditorDebuggerNode::EditorDebuggerNode() { add_theme_constant_override("margin_right", -EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("BottomPanelDebuggerOverride"), SNAME("EditorStyles"))->get_margin(SIDE_RIGHT)); tabs = memnew(TabContainer); - tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT); tabs->set_tabs_visible(false); tabs->connect("tab_changed", callable_mp(this, &EditorDebuggerNode::_debugger_changed)); add_child(tabs); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index f6fdd5fc57e..bb6428cdf01 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1658,7 +1658,6 @@ bool ScriptEditorDebugger::has_capture(const StringName &p_name) { ScriptEditorDebugger::ScriptEditorDebugger() { tabs = memnew(TabContainer); - tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT); tabs->add_theme_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_theme_stylebox(SNAME("DebuggerPanel"), SNAME("EditorStyles"))); tabs->connect("tab_changed", callable_mp(this, &ScriptEditorDebugger::_tab_changed)); diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 4ba30eaa0ee..767e531338e 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -159,6 +159,7 @@ EditorAbout::EditorAbout() { hbc->add_child(version_info_vbc); TabContainer *tc = memnew(TabContainer); + tc->set_tab_alignment(TabBar::ALIGNMENT_CENTER); tc->set_custom_minimum_size(Size2(950, 400) * EDSCALE); tc->set_v_size_flags(Control::SIZE_EXPAND_FILL); vbc->add_child(tc); diff --git a/editor/editor_native_shader_source_visualizer.cpp b/editor/editor_native_shader_source_visualizer.cpp index 1813963f6f1..e048f4b9f91 100644 --- a/editor/editor_native_shader_source_visualizer.cpp +++ b/editor/editor_native_shader_source_visualizer.cpp @@ -41,11 +41,13 @@ void EditorNativeShaderSourceVisualizer::_inspect_shader(RID p_shader) { RS::ShaderNativeSourceCode nsc = RS::get_singleton()->shader_get_native_source_code(p_shader); versions = memnew(TabContainer); + versions->set_tab_alignment(TabBar::ALIGNMENT_CENTER); versions->set_v_size_flags(Control::SIZE_EXPAND_FILL); versions->set_h_size_flags(Control::SIZE_EXPAND_FILL); for (int i = 0; i < nsc.versions.size(); i++) { TabContainer *vtab = memnew(TabContainer); vtab->set_name("Version " + itos(i)); + vtab->set_tab_alignment(TabBar::ALIGNMENT_CENTER); vtab->set_v_size_flags(Control::SIZE_EXPAND_FILL); vtab->set_h_size_flags(Control::SIZE_EXPAND_FILL); versions->add_child(vtab); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 824e861a0a4..d01dfb53617 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -6199,7 +6199,6 @@ EditorNode::EditorNode() { dock_slot[i]->set_v_size_flags(Control::SIZE_EXPAND_FILL); dock_slot[i]->set_popup(dock_select_popup); dock_slot[i]->connect("pre_popup_pressed", callable_mp(this, &EditorNode::_dock_pre_popup), varray(i)); - dock_slot[i]->set_tab_alignment(TabBar::ALIGNMENT_LEFT); dock_slot[i]->set_drag_to_rearrange_enabled(true); dock_slot[i]->set_tabs_rearrange_group(1); dock_slot[i]->connect("tab_changed", callable_mp(this, &EditorNode::_dock_tab_changed)); @@ -6242,7 +6241,6 @@ EditorNode::EditorNode() { scene_tabs->add_theme_style_override("tab_unselected", gui_base->get_theme_stylebox(SNAME("SceneTabBG"), SNAME("EditorStyles"))); scene_tabs->set_select_with_rmb(true); scene_tabs->add_tab("unsaved"); - scene_tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT); scene_tabs->set_tab_close_display_policy((TabBar::CloseButtonDisplayPolicy)EDITOR_GET("interface/scene_tabs/display_close_button").operator int()); scene_tabs->set_max_tab_width(int(EDITOR_GET("interface/scene_tabs/maximum_width")) * EDSCALE); scene_tabs->set_drag_to_rearrange_enabled(true); diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index eb3cf085780..63b5b5b803f 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -674,7 +674,6 @@ EditorSettingsDialog::EditorSettingsDialog() { undo_redo = memnew(UndoRedo); tabs = memnew(TabContainer); - tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT); tabs->connect("tab_changed", callable_mp(this, &EditorSettingsDialog::_tabs_tab_changed)); add_child(tabs); diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 2ecc4839383..8904e012cf5 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -1393,6 +1393,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() { add_child(root_vb); main_pages = memnew(TabContainer); + main_pages->set_tab_alignment(TabBar::ALIGNMENT_CENTER); main_pages->set_v_size_flags(Control::SIZE_EXPAND_FILL); main_pages->set_h_size_flags(Control::SIZE_EXPAND_FILL); root_vb->add_child(main_pages); diff --git a/editor/localization_editor.cpp b/editor/localization_editor.cpp index 77594dde78e..c31c3f4519c 100644 --- a/editor/localization_editor.cpp +++ b/editor/localization_editor.cpp @@ -476,7 +476,6 @@ LocalizationEditor::LocalizationEditor() { localization_changed = "localization_changed"; TabContainer *translations = memnew(TabContainer); - translations->set_tab_alignment(TabBar::ALIGNMENT_LEFT); translations->set_v_size_flags(Control::SIZE_EXPAND_FILL); add_child(translations); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index d313b98a7f8..e17bea0f2a7 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -1887,7 +1887,6 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito theme_type_editor = p_theme_type_editor; tc = memnew(TabContainer); - tc->set_tab_alignment(TabBar::ALIGNMENT_LEFT); add_child(tc); // Edit Items tab. @@ -2046,6 +2045,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito // Import Items tab. TabContainer *import_tc = memnew(TabContainer); + import_tc->set_tab_alignment(TabBar::ALIGNMENT_CENTER); tc->add_child(import_tc); tc->set_tab_title(1, TTR("Import Items")); @@ -3393,6 +3393,7 @@ ThemeTypeEditor::ThemeTypeEditor() { add_default_items_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_add_default_type_items)); data_type_tabs = memnew(TabContainer); + data_type_tabs->set_tab_alignment(TabBar::ALIGNMENT_CENTER); main_vb->add_child(data_type_tabs); data_type_tabs->set_v_size_flags(SIZE_EXPAND_FILL); data_type_tabs->set_use_hidden_tabs_for_min_size(true); @@ -3640,7 +3641,6 @@ ThemeEditor::ThemeEditor() { preview_tabs_vb->add_child(preview_tabs_content); preview_tabs = memnew(TabBar); - preview_tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT); preview_tabs->set_h_size_flags(SIZE_EXPAND_FILL); preview_tabbar_hb->add_child(preview_tabs); preview_tabs->connect("tab_changed", callable_mp(this, &ThemeEditor::_change_preview_tab)); diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 8d8c65f2c43..c1a95c11f68 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -3989,6 +3989,7 @@ TileMapEditor::TileMapEditor() { // TabBar. tabs_bar = memnew(TabBar); + tabs_bar->set_tab_alignment(TabBar::ALIGNMENT_CENTER); tabs_bar->set_clip_tabs(false); for (int plugin_index = 0; plugin_index < tile_map_editor_plugins.size(); plugin_index++) { Vector tabs_vector = tile_map_editor_plugins[plugin_index]->get_tabs(); diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 8b0b184f54a..fb4a5639921 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -664,6 +664,7 @@ TileSetEditor::TileSetEditor() { // TabBar. tabs_bar = memnew(TabBar); + tabs_bar->set_tab_alignment(TabBar::ALIGNMENT_CENTER); tabs_bar->set_clip_tabs(false); tabs_bar->add_tab(TTR("Tiles")); tabs_bar->add_tab(TTR("Patterns")); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 9963ac02323..cd9aef1e998 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -1056,7 +1056,6 @@ ProjectExportDialog::ProjectExportDialog() { // Subsections. sections = memnew(TabContainer); - sections->set_tab_alignment(TabBar::ALIGNMENT_LEFT); sections->set_use_hidden_tabs_for_min_size(true); settings_vb->add_child(sections); sections->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index d32f935b542..25e3079a2c3 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2560,7 +2560,6 @@ ProjectManager::ProjectManager() { tabs = memnew(TabContainer); center_box->add_child(tabs); tabs->set_anchors_and_offsets_preset(Control::PRESET_WIDE); - tabs->set_tab_alignment(TabBar::ALIGNMENT_LEFT); tabs->connect("tab_changed", callable_mp(this, &ProjectManager::_on_tab_changed)); HBoxContainer *projects_hb = memnew(HBoxContainer); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 98f8aefea0a..1318287dc85 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -559,7 +559,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { data = p_data; tab_container = memnew(TabContainer); - tab_container->set_tab_alignment(TabBar::ALIGNMENT_LEFT); tab_container->set_use_hidden_tabs_for_min_size(true); add_child(tab_container); diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index 93c5b9ad4c5..1d9e799a30b 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -114,7 +114,6 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und vbc->add_child(cbut_collapse_features); tabc_features = memnew(TabContainer); - tabc_features->set_tab_alignment(TabBar::ALIGNMENT_LEFT); tabc_features->set_use_hidden_tabs_for_min_size(true); vbc->add_child(tabc_features); diff --git a/scene/gui/tab_bar.h b/scene/gui/tab_bar.h index 0f2184aca73..e0c4ba85ef0 100644 --- a/scene/gui/tab_bar.h +++ b/scene/gui/tab_bar.h @@ -86,7 +86,7 @@ private: Vector tabs; int current = 0; int previous = 0; - AlignmentMode tab_alignment = ALIGNMENT_CENTER; + AlignmentMode tab_alignment = ALIGNMENT_LEFT; bool clip_tabs = true; int rb_hover = -1; bool rb_pressing = false;