Skip to content

slint::ComponentWeakHandle Class

template <typename T>
class ComponentWeakHandle;
C++
#include <slint.h>
C++

A weak reference to the component. Can be constructed from a ComponentHandle<T>

slint::ComponentWeakHandle< T >::ComponentWeakHandle()=default

Constructs a null ComponentWeakHandle. lock() will always return empty.

slint::ComponentWeakHandle< T >::ComponentWeakHandle(const ComponentHandle< T > &other)

Copy-constructs a new ComponentWeakHandle from other.

std::optional< ComponentHandle< T > > slint::ComponentWeakHandle< T >::lock() const

Returns a new strong ComponentHandle<T> if the component the weak handle points to is still referenced by any other ComponentHandle<T>. An empty std::optional is returned otherwise.


© 2026 SixtyFPS GmbH