I'm using gtk-rs with GTK4. I have a custom widget representing a row in a GtkListView widget. My custom widget (MyRow
) is defined exactly as done in the book (see https://github.com/gtk-rs/gtk4-rs/tree/master/book/listings/todo/1/task_row).
I want to create a binding between a property of the object contained in the model and the row widget. Following the principle of the other bindings, I have done the following:
let my_binding = object
.bind_property("my-property", &self, "css-classes")
.sync_create()
.build();
However, I get the following error on compilation:
error[E0277]: the trait bound `&my_row::MyRow: gtk4::prelude::ObjectType` is not satisfied
--> src/my_row.rs:120:42
|
120 | .bind_property("my-property", &self, "css-classes")
| ------------- ^^^^^ the trait `gtk4::prelude::ObjectType` is not implemented for `&my_row::MyRow`
| |
| required by a bound introduced by this call
The required argument type is T : ObjectType
. I also tried with &self.imp()
. I'm confused as to why this doesn't work, since ObjectType
is supposedly implemented for all subclasses of glib::Object
, which MyRow
definitely is (or is it?).
What would be the correct argument to pass, and why?