-
My current implementation kind of works, but not ideal, here is the code. let mut logs: Vec<StandardListViewItem> = ui.get_log_model().iter().collect();
logs.push(StandardListViewItem {
text: some_text.clone().into(),
});
let logs_model = Rc::new(slint::VecModel::from(logs));
ui.set_log_model(logs_model.into());
It's kind of wired, get whole vector of StandardListViewItem, push new, set the vector to the model, maybe I'm not doing it correct? Ideally I should do something like |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
What does your |
Beta Was this translation helpful? Give feedback.
-
The idea is that you would keep a reference to the You can also do |
Beta Was this translation helpful? Give feedback.
The idea is that you would keep a reference to the
VecModel
and you can add your log like that.You can also do
ui.get_log_model().as_any().downcast_ref::<slint::VecModel<StandardListViewItem>>()
to get the VecModel back (assuming you initialized the model with a VecModel before)