mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Remove item from ItemTreeNode
... and make ItemTreeNode non-generic this way. The Item is now only in the extra ItemArray struct and we are free to expose the ItemTree further.
This commit is contained in:
parent
1240c1d0b8
commit
095537e3fd
5 changed files with 14 additions and 32 deletions
|
@ -832,15 +832,8 @@ fn generate_item_tree(
|
|||
let item_array_index = item_array.len() as u32;
|
||||
|
||||
item_tree_array.push(format!(
|
||||
"slint::private_api::make_item_node({} offsetof({}, {}), {}, {}, {}, {}, {})",
|
||||
compo_offset,
|
||||
&ident(&sub_component.name),
|
||||
ident(&item.name),
|
||||
item.ty.cpp_vtable_getter,
|
||||
children_count,
|
||||
children_index,
|
||||
parent_index,
|
||||
item_array_index,
|
||||
"slint::private_api::make_item_node({}, {}, {}, {})",
|
||||
children_count, children_index, parent_index, item_array_index,
|
||||
));
|
||||
item_array.push(format!(
|
||||
"{{ {}, {} offsetof({}, {}) }}",
|
||||
|
|
|
@ -988,7 +988,6 @@ fn generate_item_tree(
|
|||
let item_array_len = item_array.len() as u32;
|
||||
item_tree_array.push(quote!(
|
||||
slint::re_exports::ItemTreeNode::Item{
|
||||
item: VOffset::new(#path #field #flick),
|
||||
children_count: #children_count,
|
||||
children_index: #children_index,
|
||||
parent_index: #parent_index,
|
||||
|
@ -1022,11 +1021,11 @@ fn generate_item_tree(
|
|||
self_rc
|
||||
}
|
||||
|
||||
fn item_tree() -> &'static [slint::re_exports::ItemTreeNode<Self>] {
|
||||
fn item_tree() -> &'static [slint::re_exports::ItemTreeNode] {
|
||||
use slint::re_exports::*;
|
||||
// FIXME: ideally this should be a const, but we can't because of the pointer to the vtable
|
||||
static ITEM_TREE : slint::re_exports::OnceBox<
|
||||
[slint::re_exports::ItemTreeNode<#inner_component_id>; #item_tree_array_len]
|
||||
[slint::re_exports::ItemTreeNode; #item_tree_array_len]
|
||||
> = slint::re_exports::OnceBox::new();
|
||||
&*ITEM_TREE.get_or_init(|| Box::new([#(#item_tree_array),*]))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue