Use InputMap actions consistently across all LineEdit's that filter an underlying Tree or ItemList.

- Instead of checking for Key::UP, Key::DOWN, Key::PAGEUP, Key::PAGEDOWN etc., we rather check for the action like 'ui_up' or 'ui_down'.
- Also use AcceptDialog's 'register_text_enter' functionality to consistently close a dialog when ENTER is pressed while the LineEdit has focus (instead of redirecting ENTER keys to e.g. the underlying Tree).
- Unify the LineEdit filter behavior for the SceneTreeDialog and corresponding usages
- Improve OK Button disablement (something should be selected)
This commit is contained in:
Marius Hanl 2024-08-31 19:23:34 +02:00
parent 61598c5c88
commit 74f64aaf98
23 changed files with 140 additions and 205 deletions

View file

@ -2174,19 +2174,13 @@ 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::_type_filter_input(const Ref<InputEvent> &p_event) {
// Redirect navigational key events to the item list.
Ref<InputEventKey> key = p_event;
if (key.is_valid()) {
if (key->is_action("ui_up", true) || key->is_action("ui_down", true) || key->is_action("ui_page_up") || key->is_action("ui_page_down")) {
add_type_options->gui_input(key);
add_type_filter->accept_event();
}
}
}