summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Hanl <mariushanl@web.de>2024-08-28 12:13:07 +0200
committerMarius Hanl <mariushanl@web.de>2024-08-28 12:57:49 +0200
commitff9946f81790bdad0687c93b61fc0ac50cba4af0 (patch)
tree84211ed19fdc9aa492c12deffa50b31d41900f3b
parent108c603f91b94100a1adc989316a372f0a6f8989 (diff)
downloadredot-engine-ff9946f81790bdad0687c93b61fc0ac50cba4af0.tar.gz
Make ThemeTypeDialog List navigatable when the LineEdit selected
This behavior is the same as in the CreateDialog. The arrow keys or page up/page down navigate the List while the LineEdit has focus.
-rw-r--r--editor/plugins/theme_editor_plugin.cpp19
-rw-r--r--editor/plugins/theme_editor_plugin.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp
index 99635a2531..ea1756b65a 100644
--- a/editor/plugins/theme_editor_plugin.cpp
+++ b/editor/plugins/theme_editor_plugin.cpp
@@ -2174,8 +2174,26 @@ void ThemeTypeDialog::_add_type_filter_cbk(const String &p_value) {
_update_add_type_options(p_value);
}
+void ThemeTypeDialog::_type_filter_input(const Ref<InputEvent> &p_ie) {
+ Ref<InputEventKey> k = p_ie;
+ if (k.is_valid() && k->is_pressed()) {
+ switch (k->get_keycode()) {
+ case Key::UP:
+ case Key::DOWN:
+ case Key::PAGEUP:
+ case Key::PAGEDOWN: {
+ add_type_options->gui_input(k);
+ add_type_filter->accept_event();
+ } break;
+ default:
+ break;
+ }
+ }
+}
+
void ThemeTypeDialog::_add_type_options_cbk(int p_index) {
add_type_filter->set_text(add_type_options->get_item_text(p_index));
+ add_type_filter->set_caret_column(add_type_filter->get_text().length());
}
void ThemeTypeDialog::_add_type_dialog_entered(const String &p_value) {
@@ -2245,6 +2263,7 @@ ThemeTypeDialog::ThemeTypeDialog() {
add_type_vb->add_child(add_type_filter);
add_type_filter->connect(SceneStringName(text_changed), callable_mp(this, &ThemeTypeDialog::_add_type_filter_cbk));
add_type_filter->connect("text_submitted", callable_mp(this, &ThemeTypeDialog::_add_type_dialog_entered));
+ add_type_filter->connect(SceneStringName(gui_input), callable_mp(this, &ThemeTypeDialog::_type_filter_input));
Label *add_type_options_label = memnew(Label);
add_type_options_label->set_text(TTR("Available Node-based types:"));
diff --git a/editor/plugins/theme_editor_plugin.h b/editor/plugins/theme_editor_plugin.h
index ba8e3a30b7..ae92365c32 100644
--- a/editor/plugins/theme_editor_plugin.h
+++ b/editor/plugins/theme_editor_plugin.h
@@ -303,6 +303,7 @@ class ThemeTypeDialog : public ConfirmationDialog {
void _update_add_type_options(const String &p_filter = "");
void _add_type_filter_cbk(const String &p_value);
+ void _type_filter_input(const Ref<InputEvent> &p_ie);
void _add_type_options_cbk(int p_index);
void _add_type_dialog_entered(const String &p_value);
void _add_type_dialog_activated(int p_index);