I am trying to insert an image into a header bar in GTK4. The image should fit the height of the parent widget. In gtk4-rs I tried:
let image = gtk::Picture::builder()
.hexpand(false)
.vexpand(false)
.halign(gtk::Align::Fill)
.valign(gtk::Align::Fill)
.keep_aspect_ratio(true)
.can_shrink(true)
.build();
Although can_shrink(true)
is set, the image causes the header to grow. I also tried .height_request(1).width_request(1)
, but that also had no effect.
How can I make the image fit the header's size determined by the other widgets in the header?