mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 22:01:13 +00:00
Add a function in the ComponentVTable to get an ItemRef from an index
Needed to adjust vtable so it can work if the return type has a reference
This commit is contained in:
parent
fb2f4d7508
commit
7f66ca9584
8 changed files with 87 additions and 9 deletions
|
@ -152,6 +152,12 @@ constexpr inline ItemTreeNode make_dyn_node(std::uintptr_t offset)
|
|||
return ItemTreeNode { ItemTreeNode::DynamicTree_Body { ItemTreeNode::Tag::DynamicTree,
|
||||
offset } };
|
||||
}
|
||||
|
||||
inline ItemRef get_item_ref(ComponentRef component, Slice<ItemTreeNode> item_tree, int index) {
|
||||
const auto &item = item_tree.ptr[index].item.item;
|
||||
return ItemRef { item.vtable, reinterpret_cast<char*>(component.instance) + item.offset };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
using cbindgen_private::FocusEvent;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue