Skip to content

Commit 8749308

Browse files
committed
Merge pull request #111913 from bruvzg/ed_spin
Use `EditorSpinSlider` in the theme editor.
2 parents 51d5a17 + 1bcc499 commit 8749308

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

editor/scene/gui/theme_editor_plugin.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "editor/file_system/editor_file_system.h"
4040
#include "editor/gui/editor_bottom_panel.h"
4141
#include "editor/gui/editor_file_dialog.h"
42+
#include "editor/gui/editor_spin_slider.h"
4243
#include "editor/gui/progress_dialog.h"
4344
#include "editor/inspector/editor_resource_picker.h"
4445
#include "editor/settings/editor_command_palette.h"
@@ -50,7 +51,6 @@
5051
#include "scene/gui/panel_container.h"
5152
#include "scene/gui/scroll_container.h"
5253
#include "scene/gui/separator.h"
53-
#include "scene/gui/spin_box.h"
5454
#include "scene/gui/split_container.h"
5555
#include "scene/gui/tab_bar.h"
5656
#include "scene/gui/tab_container.h"
@@ -2630,10 +2630,11 @@ void ThemeTypeEditor::_update_type_items() {
26302630
HashMap<StringName, bool> constant_items = _get_type_items(edited_type, Theme::DATA_TYPE_CONSTANT, show_default);
26312631
for (const KeyValue<StringName, bool> &E : constant_items) {
26322632
HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_CONSTANT, E.key, E.value);
2633-
SpinBox *item_editor = memnew(SpinBox);
2633+
EditorSpinSlider *item_editor = memnew(EditorSpinSlider);
26342634
item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
26352635
item_editor->set_min(-100000);
26362636
item_editor->set_max(100000);
2637+
item_editor->set_editing_integer(true);
26372638
item_editor->set_step(1);
26382639
item_editor->set_allow_lesser(true);
26392640
item_editor->set_allow_greater(true);
@@ -2644,7 +2645,7 @@ void ThemeTypeEditor::_update_type_items() {
26442645
item_editor->connect(SceneStringName(value_changed), callable_mp(this, &ThemeTypeEditor::_constant_item_changed).bind(E.key));
26452646
} else {
26462647
item_editor->set_value(ThemeDB::get_singleton()->get_default_theme()->get_constant(E.key, edited_type));
2647-
item_editor->set_editable(false);
2648+
item_editor->set_read_only(true);
26482649
}
26492650

26502651
_add_focusable(item_editor);
@@ -2702,10 +2703,11 @@ void ThemeTypeEditor::_update_type_items() {
27022703
HashMap<StringName, bool> font_size_items = _get_type_items(edited_type, Theme::DATA_TYPE_FONT_SIZE, show_default);
27032704
for (const KeyValue<StringName, bool> &E : font_size_items) {
27042705
HBoxContainer *item_control = _create_property_control(Theme::DATA_TYPE_FONT_SIZE, E.key, E.value);
2705-
SpinBox *item_editor = memnew(SpinBox);
2706+
EditorSpinSlider *item_editor = memnew(EditorSpinSlider);
27062707
item_editor->set_h_size_flags(SIZE_EXPAND_FILL);
27072708
item_editor->set_min(-100000);
27082709
item_editor->set_max(100000);
2710+
item_editor->set_editing_integer(true);
27092711
item_editor->set_step(1);
27102712
item_editor->set_allow_lesser(true);
27112713
item_editor->set_allow_greater(true);
@@ -2716,7 +2718,7 @@ void ThemeTypeEditor::_update_type_items() {
27162718
item_editor->connect(SceneStringName(value_changed), callable_mp(this, &ThemeTypeEditor::_font_size_item_changed).bind(E.key));
27172719
} else {
27182720
item_editor->set_value(ThemeDB::get_singleton()->get_default_theme()->get_font_size(E.key, edited_type));
2719-
item_editor->set_editable(false);
2721+
item_editor->set_read_only(true);
27202722
}
27212723

27222724
_add_focusable(item_editor);

0 commit comments

Comments
 (0)