diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml index 7fbdd4272dd..392364425ba 100644 --- a/doc/classes/AcceptDialog.xml +++ b/doc/classes/AcceptDialog.xml @@ -100,6 +100,12 @@ + + The minimum height of each button in the bottom row (such as OK/Cancel) in pixels. This can be increased to make buttons with short texts easier to click/tap. + + + The minimum width of each button in the bottom row (such as OK/Cancel) in pixels. This can be increased to make buttons with short texts easier to click/tap. + The size of the vertical space between the dialog's content and the button row. diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index 734fa415a39..f74be7d978d 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -356,20 +356,25 @@ EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config( if (config.spacing_preset != "Custom") { int preset_base_spacing = 0; int preset_extra_spacing = 0; + Size2 preset_dialogs_buttons_min_size; if (config.spacing_preset == "Compact") { preset_base_spacing = 0; preset_extra_spacing = 4; + preset_dialogs_buttons_min_size = Size2(90, 26); } else if (config.spacing_preset == "Spacious") { preset_base_spacing = 6; preset_extra_spacing = 2; + preset_dialogs_buttons_min_size = Size2(112, 36); } else { // Default preset_base_spacing = 4; preset_extra_spacing = 0; + preset_dialogs_buttons_min_size = Size2(105, 34); } config.base_spacing = preset_base_spacing; config.extra_spacing = preset_extra_spacing; + config.dialogs_buttons_min_size = preset_dialogs_buttons_min_size; EditorSettings::get_singleton()->set_initial_value("interface/theme/base_spacing", config.base_spacing); EditorSettings::get_singleton()->set_initial_value("interface/theme/additional_spacing", config.extra_spacing); @@ -1271,6 +1276,9 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // AcceptDialog. p_theme->set_stylebox("panel", "AcceptDialog", p_config.dialog_style); p_theme->set_constant("buttons_separation", "AcceptDialog", 8 * EDSCALE); + // Make buttons with short texts such as "OK" easier to click/tap. + p_theme->set_constant("buttons_min_width", "AcceptDialog", p_config.dialogs_buttons_min_size.x * EDSCALE); + p_theme->set_constant("buttons_min_height", "AcceptDialog", p_config.dialogs_buttons_min_size.y * EDSCALE); // FileDialog. p_theme->set_icon("folder", "FileDialog", p_theme->get_icon(SNAME("Folder"), EditorStringName(EditorIcons))); diff --git a/editor/themes/editor_theme_manager.h b/editor/themes/editor_theme_manager.h index 3eb1dd5ffdc..5e7bd000835 100644 --- a/editor/themes/editor_theme_manager.h +++ b/editor/themes/editor_theme_manager.h @@ -62,6 +62,7 @@ class EditorThemeManager { int base_spacing = 4; int extra_spacing = 0; + Size2 dialogs_buttons_min_size = Size2(105, 34); int border_width = 0; int corner_radius = 3; diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 4d006463919..e481b78715f 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -210,6 +210,15 @@ void AcceptDialog::_update_child_rects() { bg_panel->set_position(Point2()); bg_panel->set_size(dlg_size); + for (int i = 0; i < buttons_hbox->get_child_count(); i++) { + Button *b = Object::cast_to