slint icon indicating copy to clipboard operation
slint copied to clipboard

Using non standard types in listview struct/model?

Open Gibbz opened this issue 2 months ago • 2 comments

In my appwindow.slint file I have a list view that I want to populate from my rust code. I'm doing a bluetooth scanner, so want to keep a list of peripheral devices in the listview item.

How do I go about setting that up in the slint file? What I have

@rust-attr(derive(serde::Serialize, serde::Deserialize))
export struct ScanItem  {
    title: string,
    checked: bool,
    peripheral: btleplug::api::Peripheral, // <-- this doent work
}

Gibbz avatar Apr 12 '24 11:04 Gibbz

Slint struct and other types can currently only contains fields of type known to Slint. I don't know if we can support this usecase. It can be worked around by using an integer id, and have mapping between id and the actual type in Rust.

ogoffart avatar Apr 12 '24 13:04 ogoffart