mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 11:32:13 +00:00
Merge pull request #97890 from timothyqiu/id-focused
Fix `PopupMenu.id_focused` signal using index as ID
This commit is contained in:
commit
b1526f45b8
@ -178,7 +178,7 @@ bool OptionButton::_set(const StringName &p_name, const Variant &p_value) {
|
||||
}
|
||||
|
||||
void OptionButton::_focused(int p_which) {
|
||||
emit_signal(SNAME("item_focused"), p_which);
|
||||
emit_signal(SNAME("item_focused"), popup->get_item_index(p_which));
|
||||
}
|
||||
|
||||
void OptionButton::_selected(int p_which) {
|
||||
|
@ -474,7 +474,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
|
||||
for (int i = search_from; i < items.size(); i++) {
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
set_input_as_handled();
|
||||
@ -488,7 +488,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
|
||||
for (int i = 0; i < search_from; i++) {
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
set_input_as_handled();
|
||||
@ -512,7 +512,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
|
||||
for (int i = search_from; i >= 0; i--) {
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
set_input_as_handled();
|
||||
@ -526,7 +526,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
|
||||
for (int i = items.size() - 1; i >= search_from; i--) {
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
set_input_as_handled();
|
||||
@ -692,7 +692,7 @@ void PopupMenu::_input_from_window_internal(const Ref<InputEvent> &p_event) {
|
||||
|
||||
if (items[i].text.findn(search_string) == 0) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
set_input_as_handled();
|
||||
@ -1091,7 +1091,7 @@ void PopupMenu::_notification(int p_what) {
|
||||
for (int i = search_from; i < items.size(); i++) {
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
match_found = true;
|
||||
@ -1104,7 +1104,7 @@ void PopupMenu::_notification(int p_what) {
|
||||
for (int i = 0; i < search_from; i++) {
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
break;
|
||||
@ -1124,7 +1124,7 @@ void PopupMenu::_notification(int p_what) {
|
||||
for (int i = search_from; i >= 0; i--) {
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
match_found = true;
|
||||
@ -1137,7 +1137,7 @@ void PopupMenu::_notification(int p_what) {
|
||||
for (int i = items.size() - 1; i >= search_from; i--) {
|
||||
if (!items[i].separator && !items[i].disabled) {
|
||||
mouse_over = i;
|
||||
emit_signal(SNAME("id_focused"), i);
|
||||
emit_signal(SNAME("id_focused"), items[i].id);
|
||||
scroll_to_item(i);
|
||||
control->queue_redraw();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user