Structs reactivity in slit and c++ side #5751
Unanswered
hellozyemlya
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Also, in javascript react world there is an approach with immutable state. If you have some model, and if any model leaf changed, you recreate whole model, copying non-changed fields, replacing changed, starting from leaf to model root. So state management library can track what components to re-render. Is that approach will work well on slint? Or setting big struct will re-trigger too much calculations? |
Beta Was this translation helpful? Give feedback.
1 reply
-
The auto s = win->get_my_struct();
s.somefield = "123";
win->set_my_struct(s); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Starting learning slint, looks very interesting. Trying to get some feedback from c++ side. I learned that props can be changed, that there is model, where I can add-remove items. But structs... They are copied between slint and cpp realms, right? In slit structs are "reactive" just like properties, but if I try to run
win->get_my_struct().somefield = "123"
, no changes applied on slit side. Is that intended? So If I have list of models, and I need to alter them in c++, I need to change whole struct entirely, right?Also, if structs is not reactive in c++, I may suppose that structs is not the best way to store reactive data in slit side as well? Or that somehow handled?
Beta Was this translation helpful? Give feedback.
All reactions