How to get all items from a GtkComboBoxText in GTK4 (Rust, GTK-Rs)?

62 views Asked by At

What I wanna do is set the selected item in ComboboxText. I know that should be done using set_active() method, but that requires a position (index). All I have is the selected value (string).

So I think I should iterate over all the items and find the position of the right one this way. Is this correct? Or is there a better way to do this?

How can I obtain a list of the items?

let combo: ComboBoxText = self.widget.clone().downcast::<ComboBoxText>().unwrap();
let model = combo.model().unwrap();
// how to get an iterator here?
0

There are 0 answers