mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-30 22:01:13 +00:00
Use ComponentRc during item tree traversal
This is in preparation for allowing the run-time / items to clone VRc's of the component. ComponentVTable functions like visit_children_item contine to take a ComponentRefPin as "self" parameter type, as a VRc would not be supported by rust right now. That means the implementation then uses self_weak to obtain a strong self-reference.
This commit is contained in:
parent
54cc66c400
commit
78fae068dd
9 changed files with 72 additions and 49 deletions
|
@ -74,6 +74,8 @@ private:
|
|||
X data;
|
||||
Layout layout;
|
||||
};
|
||||
|
||||
void *data_ptr() { return reinterpret_cast<char *>(this) + data_offset; }
|
||||
};
|
||||
|
||||
struct Dyn {};
|
||||
|
@ -120,6 +122,8 @@ public:
|
|||
}
|
||||
|
||||
VRc<VTable, Dyn> into_dyn() const { return *reinterpret_cast<const VRc<VTable, Dyn> *>(this); }
|
||||
|
||||
VRef<VTable> borrow() const { return { inner->vtable, inner->data_ptr() }; }
|
||||
};
|
||||
|
||||
template<typename VTable, typename X = Dyn>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue