Merge pull request #21090 from hpvb/fix-19842-redux
Delay emitting pressed signals in PopupMenu
This commit is contained in:
commit
d7b892294b
|
@ -1071,22 +1071,26 @@ void PopupMenu::activate_item(int p_item) {
|
||||||
pop = Object::cast_to<PopupMenu>(next);
|
pop = Object::cast_to<PopupMenu>(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit_signal("id_pressed", id);
|
|
||||||
emit_signal("index_pressed", p_item);
|
|
||||||
|
|
||||||
// Hides popup by default; unless otherwise specified
|
// Hides popup by default; unless otherwise specified
|
||||||
// by using set_hide_on_item_selection and set_hide_on_checkable_item_selection
|
// by using set_hide_on_item_selection and set_hide_on_checkable_item_selection
|
||||||
|
|
||||||
|
bool need_hide = true;
|
||||||
|
|
||||||
if (items[p_item].checkable_type) {
|
if (items[p_item].checkable_type) {
|
||||||
if (!hide_on_checkable_item_selection)
|
if (!hide_on_checkable_item_selection)
|
||||||
return;
|
need_hide = false;
|
||||||
} else if (0 < items[p_item].max_states) {
|
} else if (0 < items[p_item].max_states) {
|
||||||
if (!hide_on_multistate_item_selection)
|
if (!hide_on_multistate_item_selection)
|
||||||
return;
|
need_hide = false;
|
||||||
} else if (!hide_on_item_selection)
|
} else if (!hide_on_item_selection)
|
||||||
return;
|
need_hide = false;
|
||||||
|
|
||||||
hide();
|
emit_signal("id_pressed", id);
|
||||||
|
emit_signal("index_pressed", p_item);
|
||||||
|
|
||||||
|
if (need_hide) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopupMenu::remove_item(int p_idx) {
|
void PopupMenu::remove_item(int p_idx) {
|
||||||
|
|
Loading…
Reference in New Issue