c++: Generate better indices for the parent node of repeaters

This commit is contained in:
Tobias Hunger 2022-03-31 11:32:07 +02:00 committed by Tobias Hunger
parent 8a036ef293
commit 1888ecfd65
2 changed files with 2 additions and 2 deletions

View file

@ -942,7 +942,7 @@ fn generate_item_tree(
format!(
// that does not work when the parent is not a component with a ComponentVTable
//" *result = slint::private_api::parent_item(self->parent->self_weak.into_dyn(), self->parent->get_item_tree(), {});",
"*result = {{ self->parent->self_weak, {} }};",
"*result = {{ self->parent->self_weak, self->parent->tree_index_of_first_child + {} - 1 }};",
parent_index,
)
} else {

View file

@ -1027,7 +1027,7 @@ fn generate_item_tree(
.parent
.clone()
.upgrade()
.map(|sc| (VRcMapped::origin(&sc), sc.as_pin_ref().tree_index_of_first_child.get()))
.map(|sc| (VRcMapped::origin(&sc), sc.tree_index_of_first_child.get()))
{
*result = slint::re_exports::ItemRc::new(parent_component, parent_index as usize + #sub_component_offset - 1)
.downgrade();