How to pass a struct into slint component? #2926
-
There is callback element inside a slint component. But it can only be a stateless function. If I want to pass a struct with its own state and method. And let the event (click ...) to access and modify this struct and also invoke the struct's method. What should I do? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can define struct in slint with
Then you can use this string in a property, or a callback, like so:
You can also have property or callback on That way you can access, from native code, to struct declared in Slint by adding a callback handler. If you want to access structs written in native code for slint, this hasn't been implemented yet, but is planed in #1726 |
Beta Was this translation helpful? Give feedback.
You can define struct in slint with
Then you can use this string in a property, or a callback, like so:
You can also have property or callback on
global
.That way you can access, from native code, to struct declared in Slint by adding a callback handler.
If you want to access structs written in native code for slint, this hasn't been implemented yet, but is planed in #1726