slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.94k stars 568 forks source link

unable to convert Vec<String> into mismatched types expected struct `ModelRc<slint::SharedString>` found struct `Vec<String>`rustcClick for full compiler diagnostic #4633

Closed learncodingforweb closed 7 months ago

learncodingforweb commented 7 months ago

slint=1.4.1 unable to convert Vec into ModelRc

export component AppWindow inherits Window {
    width: 480px;
    height: 320px;
    in-out property<int> counter: 42;
    in-out property <[string]> ports;
    callback request-increase-value();
    VerticalBox {
        HorizontalBox {
            ComboBox {
                // model: ["com1", "com2"];
                model: ports;
            }
            Button {
                text: "open";
            }
        }
        Text {
            text: "Counter: \{root.counter}";
        }
        Button {
            text: "Increase value";
            clicked => {
                root.request-increase-value();
            }
        }

    }
}

how can i set ports in rust code? where in rust code i am having value in Vec? unable to find any solution?

ogoffart commented 7 months ago

Somebody just asked recently the same question in this discussion: https://github.com/slint-ui/slint/discussions/4632

So I'm closing this as a duplicate

Note: for questions, please use the discussions: https://github.com/slint-ui/slint/discussions issues are meant for bug reports.