Hi, I have a question. I’m creating a GUI application in Rust that uses GTK4 and I’m creating a custom widget, but I’d like to have the size of my widget displayed on the screen in my widget’s subclass. How can I do this?
#[derive(CompositeTemplate, Default)]
#[template(resource = "/glushkovizer.ui")]
pub struct GlushkovizerApp {
#[template_child]
pub entry: TemplateChild<Entry>,
#[template_child]
pub image: TemplateChild<Image>,
}
#[glib::object_subclass]
impl ObjectSubclass for GlushkovizerApp {
const NAME: &'static str = "GlushkovizerApp";
type Type = super::GlushkovizerApp;
type ParentType = gtk::ApplicationWindow;
fn class_init(klass: &mut Self::Class) {
klass.bind_template();
klass.bind_template_callbacks();
}
fn instance_init(obj: &InitializingObject<Self>) {
obj.init_template();
}
}
impl GlushkovizerApp {
fn toto(&self) {
let width = ;// screen size of my widget (with idk self.function_unbelievable())
}
}
With something like this. I don’t know if it’s possible