1
0
Fork 0

Prevent some internal nodes being duplicated in Controls

This commit is contained in:
A Thousand Ships 2024-02-08 21:06:56 +01:00 committed by AThousandShips
parent 261e7d32d3
commit 5dcab0e606
No known key found for this signature in database
GPG Key ID: DEFC5A5B1306947D
5 changed files with 7 additions and 0 deletions

View File

@ -1741,6 +1741,7 @@ void ColorPicker::_pick_button_pressed() {
picker_preview_color->add_theme_style_override(SceneStringName(panel), picker_preview_style_box_color); picker_preview_color->add_theme_style_override(SceneStringName(panel), picker_preview_style_box_color);
add_child(picker_window, false, INTERNAL_MODE_FRONT); add_child(picker_window, false, INTERNAL_MODE_FRONT);
picker_window->force_parent_owned();
} }
set_process_internal(true); set_process_internal(true);
@ -1889,6 +1890,7 @@ void ColorPicker::_pick_button_pressed_legacy() {
picker_window->hide(); picker_window->hide();
picker_window->set_transient(true); picker_window->set_transient(true);
add_child(picker_window, false, INTERNAL_MODE_FRONT); add_child(picker_window, false, INTERNAL_MODE_FRONT);
picker_window->force_parent_owned();
picker_texture_rect = memnew(TextureRect); picker_texture_rect = memnew(TextureRect);
picker_texture_rect->set_anchors_preset(Control::PRESET_FULL_RECT); picker_texture_rect->set_anchors_preset(Control::PRESET_FULL_RECT);
@ -2562,6 +2564,7 @@ void ColorPickerButton::_update_picker() {
picker->set_anchors_and_offsets_preset(PRESET_FULL_RECT); picker->set_anchors_and_offsets_preset(PRESET_FULL_RECT);
popup->add_child(picker); popup->add_child(picker);
add_child(popup, false, INTERNAL_MODE_FRONT); add_child(popup, false, INTERNAL_MODE_FRONT);
popup->force_parent_owned();
picker->connect("color_changed", callable_mp(this, &ColorPickerButton::_color_changed)); picker->connect("color_changed", callable_mp(this, &ColorPickerButton::_color_changed));
popup->connect("about_to_popup", callable_mp(this, &ColorPickerButton::_about_to_popup)); popup->connect("about_to_popup", callable_mp(this, &ColorPickerButton::_about_to_popup));
popup->connect("popup_hide", callable_mp(this, &ColorPickerButton::_modal_closed)); popup->connect("popup_hide", callable_mp(this, &ColorPickerButton::_modal_closed));

View File

@ -2701,6 +2701,7 @@ Key LineEdit::_get_menu_action_accelerator(const String &p_action) {
void LineEdit::_generate_context_menu() { void LineEdit::_generate_context_menu() {
menu = memnew(PopupMenu); menu = memnew(PopupMenu);
add_child(menu, false, INTERNAL_MODE_FRONT); add_child(menu, false, INTERNAL_MODE_FRONT);
menu->force_parent_owned();
menu_dir = memnew(PopupMenu); menu_dir = memnew(PopupMenu);
menu_dir->add_radio_check_item(ETR("Same as Layout Direction"), MENU_DIR_INHERITED); menu_dir->add_radio_check_item(ETR("Same as Layout Direction"), MENU_DIR_INHERITED);

View File

@ -6834,6 +6834,7 @@ Size2 RichTextLabel::get_minimum_size() const {
void RichTextLabel::_generate_context_menu() { void RichTextLabel::_generate_context_menu() {
menu = memnew(PopupMenu); menu = memnew(PopupMenu);
add_child(menu, false, INTERNAL_MODE_FRONT); add_child(menu, false, INTERNAL_MODE_FRONT);
menu->force_parent_owned();
menu->connect(SceneStringName(id_pressed), callable_mp(this, &RichTextLabel::menu_option)); menu->connect(SceneStringName(id_pressed), callable_mp(this, &RichTextLabel::menu_option));
menu->add_item(ETR("Copy"), MENU_COPY); menu->add_item(ETR("Copy"), MENU_COPY);

View File

@ -761,6 +761,7 @@ void TabContainer::set_all_tabs_in_front(bool p_in_front) {
remove_child(tab_bar); remove_child(tab_bar);
add_child(tab_bar, false, all_tabs_in_front ? INTERNAL_MODE_FRONT : INTERNAL_MODE_BACK); add_child(tab_bar, false, all_tabs_in_front ? INTERNAL_MODE_FRONT : INTERNAL_MODE_BACK);
tab_bar->force_parent_owned();
} }
bool TabContainer::is_all_tabs_in_front() const { bool TabContainer::is_all_tabs_in_front() const {

View File

@ -7364,6 +7364,7 @@ Key TextEdit::_get_menu_action_accelerator(const String &p_action) {
void TextEdit::_generate_context_menu() { void TextEdit::_generate_context_menu() {
menu = memnew(PopupMenu); menu = memnew(PopupMenu);
add_child(menu, false, INTERNAL_MODE_FRONT); add_child(menu, false, INTERNAL_MODE_FRONT);
menu->force_parent_owned();
menu_dir = memnew(PopupMenu); menu_dir = memnew(PopupMenu);
menu_dir->add_radio_check_item(ETR("Same as Layout Direction"), MENU_DIR_INHERITED); menu_dir->add_radio_check_item(ETR("Same as Layout Direction"), MENU_DIR_INHERITED);