Skip to content

How to use model from nested string array? #3698

Answered by ogoffart
qarmin asked this question in Q&A
Discussion options

You must be logged in to vote

you need to build a VecModel<ModelRc<SharedString>>

So something like (untested)

   let app = MainWindow::new().unwrap();//.run().unwrap();
    let row_data: Rc<VecModel<ModelRc<SharedString>>> = Rc::new(VecModel::default());
//                            ^^^^^^^ changed to ModelRc

    for r in 0..101 {
        let items = VecModel::default();

        for c in 0..3 {
            items.push(slint::format!("Item {r}.{c}").into());
        }

        row_data.push(ModelRc::new(items));
    }

    app.set_empty_folder_model(row_data.into());

    app.run().unwrap();

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by qarmin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants