From d138d296c2bc0e6218327732fd7fab5615d3dab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pa=CC=84vels=20Nadtoc=CC=8Cajevs?= <7645683+bruvzg@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:53:30 +0300 Subject: [PATCH] Use EditorSpinSlider in the theme editor. --- editor/scene/gui/theme_editor_plugin.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/editor/scene/gui/theme_editor_plugin.cpp b/editor/scene/gui/theme_editor_plugin.cpp index d0a2d4a489cb..2ed6f4160d70 100644 --- a/editor/scene/gui/theme_editor_plugin.cpp +++ b/editor/scene/gui/theme_editor_plugin.cpp @@ -39,6 +39,7 @@ #include "editor/file_system/editor_file_system.h" #include "editor/gui/editor_bottom_panel.h" #include "editor/gui/editor_file_dialog.h" +#include "editor/gui/editor_spin_slider.h" #include "editor/gui/progress_dialog.h" #include "editor/inspector/editor_resource_picker.h" #include "editor/settings/editor_command_palette.h" @@ -2630,10 +2631,11 @@ void ThemeTypeEditor::_update_type_items() { HashMap constant_items = _get_type_items(edited_type, Theme::DATA_TYPE_CONSTANT, show_default); for (const KeyValue &E : constant_items) { HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_CONSTANT, E.key, E.value); - SpinBox *item_editor = memnew(SpinBox); + EditorSpinSlider *item_editor = memnew(EditorSpinSlider); item_editor->set_h_size_flags(SIZE_EXPAND_FILL); item_editor->set_min(-100000); item_editor->set_max(100000); + item_editor->set_editing_integer(true); item_editor->set_step(1); item_editor->set_allow_lesser(true); item_editor->set_allow_greater(true); @@ -2644,7 +2646,7 @@ void ThemeTypeEditor::_update_type_items() { item_editor->connect(SceneStringName(value_changed), callable_mp(this, &ThemeTypeEditor::_constant_item_changed).bind(E.key)); } else { item_editor->set_value(ThemeDB::get_singleton()->get_default_theme()->get_constant(E.key, edited_type)); - item_editor->set_editable(false); + item_editor->set_read_only(true); } _add_focusable(item_editor); @@ -2702,10 +2704,11 @@ void ThemeTypeEditor::_update_type_items() { HashMap font_size_items = _get_type_items(edited_type, Theme::DATA_TYPE_FONT_SIZE, show_default); for (const KeyValue &E : font_size_items) { HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_FONT_SIZE, E.key, E.value); - SpinBox *item_editor = memnew(SpinBox); + EditorSpinSlider *item_editor = memnew(EditorSpinSlider); item_editor->set_h_size_flags(SIZE_EXPAND_FILL); item_editor->set_min(-100000); item_editor->set_max(100000); + item_editor->set_editing_integer(true); item_editor->set_step(1); item_editor->set_allow_lesser(true); item_editor->set_allow_greater(true); @@ -2716,7 +2719,7 @@ void ThemeTypeEditor::_update_type_items() { item_editor->connect(SceneStringName(value_changed), callable_mp(this, &ThemeTypeEditor::_font_size_item_changed).bind(E.key)); } else { item_editor->set_value(ThemeDB::get_singleton()->get_default_theme()->get_font_size(E.key, edited_type)); - item_editor->set_editable(false); + item_editor->set_read_only(true); } _add_focusable(item_editor);