diff --git a/editor/animation/animation_player_editor_plugin.cpp b/editor/animation/animation_player_editor_plugin.cpp index a186955be7..3a562c427f 100644 --- a/editor/animation/animation_player_editor_plugin.cpp +++ b/editor/animation/animation_player_editor_plugin.cpp @@ -2158,6 +2158,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug animation->set_h_size_flags(SIZE_EXPAND_FILL); animation->set_tooltip_text(TTRC("Display list of animations in player.")); animation->set_clip_text(true); + animation->set_fit_to_longest_item(false); animation->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); autoplay = memnew(Button); diff --git a/editor/asset_library/asset_library_editor_plugin.cpp b/editor/asset_library/asset_library_editor_plugin.cpp index e986037bdb..3c72a3c6f8 100644 --- a/editor/asset_library/asset_library_editor_plugin.cpp +++ b/editor/asset_library/asset_library_editor_plugin.cpp @@ -2171,6 +2171,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { sort->set_h_size_flags(Control::SIZE_EXPAND_FILL); sort->set_clip_text(true); + sort->set_fit_to_longest_item(false); sort->connect(SceneStringName(item_selected), callable_mp(this, &EditorAssetLibrary::_search).bind(1).unbind(1)); search_hb2->add_child(memnew(Label(TTRC("Category:")))); @@ -2182,6 +2183,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { } categories->set_disabled(true); categories->set_clip_text(true); + categories->set_fit_to_longest_item(false); categories->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_hb2->add_child(categories); categories->connect(SceneStringName(item_selected), callable_mp(this, &EditorAssetLibrary::_search).bind(1).unbind(1)); @@ -2190,6 +2192,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { repository = memnew(OptionButton); repository->set_h_size_flags(Control::SIZE_EXPAND_FILL); repository->set_clip_text(true); + repository->set_fit_to_longest_item(false); search_hb2->add_child(repository); repository->connect(SceneStringName(item_selected), callable_mp(this, &EditorAssetLibrary::_repository_changed)); _update_repository_options(); diff --git a/editor/audio/editor_audio_buses.cpp b/editor/audio/editor_audio_buses.cpp index bd8934fced..cd94423af5 100644 --- a/editor/audio/editor_audio_buses.cpp +++ b/editor/audio/editor_audio_buses.cpp @@ -1142,6 +1142,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { send->set_accessibility_name(TTRC("Send")); send->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); send->set_clip_text(true); + send->set_fit_to_longest_item(false); send->connect(SceneStringName(item_selected), callable_mp(this, &EditorAudioBus::_send_selected)); vb->add_child(send); diff --git a/editor/inspector/editor_properties.cpp b/editor/inspector/editor_properties.cpp index e537db06c3..1b6ad68f06 100644 --- a/editor/inspector/editor_properties.cpp +++ b/editor/inspector/editor_properties.cpp @@ -585,6 +585,7 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() { option_button->set_accessibility_name(TTRC("Enum Options")); option_button->set_h_size_flags(SIZE_EXPAND_FILL); option_button->set_clip_text(true); + option_button->set_fit_to_longest_item(false); option_button->set_flat(true); option_button->set_search_bar_enabled(true); option_button->set_search_bar_min_item_count(10); @@ -997,6 +998,7 @@ OptionButton *EditorPropertyEnum::get_option_button() { EditorPropertyEnum::EditorPropertyEnum() { options = memnew(OptionButton); options->set_clip_text(true); + options->set_fit_to_longest_item(false); options->set_flat(true); options->set_theme_type_variation(SNAME("EditorInspectorButton")); options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); diff --git a/editor/project_manager/project_manager.cpp b/editor/project_manager/project_manager.cpp index 8b3db0e82a..b43b7c3084 100644 --- a/editor/project_manager/project_manager.cpp +++ b/editor/project_manager/project_manager.cpp @@ -1568,6 +1568,7 @@ ProjectManager::ProjectManager() { filter_option = memnew(OptionButton); filter_option->set_clip_text(true); + filter_option->set_fit_to_longest_item(false); filter_option->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter_option->set_stretch_ratio(0.3); filter_option->set_accessibility_name(TTRC("Sort:")); diff --git a/editor/scene/gui/control_editor_plugin.cpp b/editor/scene/gui/control_editor_plugin.cpp index e40f272085..bc46f7b059 100644 --- a/editor/scene/gui/control_editor_plugin.cpp +++ b/editor/scene/gui/control_editor_plugin.cpp @@ -244,6 +244,7 @@ void EditorPropertyAnchorsPreset::setup(const Vector &p_options) { EditorPropertyAnchorsPreset::EditorPropertyAnchorsPreset() { options = memnew(OptionButton); options->set_clip_text(true); + options->set_fit_to_longest_item(false); options->set_flat(true); options->set_theme_type_variation(SNAME("EditorInspectorButton")); add_child(options); @@ -427,6 +428,7 @@ EditorPropertySizeFlags::EditorPropertySizeFlags() { flag_presets = memnew(OptionButton); flag_presets->set_clip_text(true); + flag_presets->set_fit_to_longest_item(false); flag_presets->set_flat(true); flag_presets->set_theme_type_variation(SNAME("EditorInspectorButton")); vb->add_child(flag_presets); diff --git a/editor/version_control/version_control_editor_plugin.cpp b/editor/version_control/version_control_editor_plugin.cpp index 59289c326a..a96a81f2a1 100644 --- a/editor/version_control/version_control_editor_plugin.cpp +++ b/editor/version_control/version_control_editor_plugin.cpp @@ -1403,6 +1403,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { branch_select->set_tooltip_text(TTR("Branches")); branch_select->set_h_size_flags(Control::SIZE_EXPAND_FILL); branch_select->set_clip_text(true); + branch_select->set_fit_to_longest_item(false); branch_select->connect(SceneStringName(item_selected), callable_mp(this, &VersionControlEditorPlugin::_branch_item_selected)); branch_select->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_refresh_branch_list)); menu_bar->add_child(branch_select); @@ -1450,6 +1451,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { remote_select->set_tooltip_text(TTR("Remotes")); remote_select->set_h_size_flags(Control::SIZE_EXPAND_FILL); remote_select->set_clip_text(true); + remote_select->set_fit_to_longest_item(false); remote_select->connect(SceneStringName(item_selected), callable_mp(this, &VersionControlEditorPlugin::_remote_selected)); remote_select->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_refresh_remote_list)); menu_bar->add_child(remote_select); diff --git a/modules/openxr/editor/openxr_binding_modifier_editor.cpp b/modules/openxr/editor/openxr_binding_modifier_editor.cpp index d4da9b4ab2..d54c56948f 100644 --- a/modules/openxr/editor/openxr_binding_modifier_editor.cpp +++ b/modules/openxr/editor/openxr_binding_modifier_editor.cpp @@ -85,6 +85,7 @@ void EditorPropertyActionSet::set_option_button_clip(bool p_enable) { EditorPropertyActionSet::EditorPropertyActionSet() { options = memnew(OptionButton); options->set_clip_text(true); + options->set_fit_to_longest_item(false); options->set_flat(true); options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); add_child(options); @@ -155,6 +156,7 @@ void EditorPropertyBindingPath::set_option_button_clip(bool p_enable) { EditorPropertyBindingPath::EditorPropertyBindingPath() { options = memnew(OptionButton); options->set_clip_text(true); + options->set_fit_to_longest_item(false); options->set_flat(true); options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); add_child(options); diff --git a/modules/visual_shader/editor/visual_shader_editor_plugin.cpp b/modules/visual_shader/editor/visual_shader_editor_plugin.cpp index 6384fc9798..27d81d2119 100644 --- a/modules/visual_shader/editor/visual_shader_editor_plugin.cpp +++ b/modules/visual_shader/editor/visual_shader_editor_plugin.cpp @@ -8368,6 +8368,7 @@ EditorPropertyVisualShaderMode::EditorPropertyVisualShaderMode() { options = memnew(OptionButton); options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); options->set_clip_text(true); + options->set_fit_to_longest_item(false); add_child(options); add_focusable(options); options->connect(SceneStringName(item_selected), callable_mp(this, &EditorPropertyVisualShaderMode::_option_selected)); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 06c1f4444c..eaa1c70761 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -2627,6 +2627,7 @@ FileDialog::FileDialog() { filter->set_stretch_ratio(3); filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter->set_clip_text(true); // Too many extensions overflows it. + filter->set_fit_to_longest_item(false); file_box->add_child(filter); filter->connect(SceneStringName(item_selected), callable_mp(this, &FileDialog::_filter_selected)); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index b37f0330bc..4e7731cbd2 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -71,6 +71,11 @@ Size2 OptionButton::get_minimum_size() const { minsize = content_size + padding; } + if (fit_to_longest_item) { + // Make the width at least the width of the popup. + minsize.width = MAX(minsize.width, popup->get_contents_minimum_size().width); + } + return minsize; }