Is it possible to change the height-request of a Gtk.ListItem?

Hello everyone!

Possibly a silly question, but I have the blueprint for a ListItemFactory in a blueprint file below.

I would like to be able to change the size of the Picture, and thus, the row, without having to recreate the entire ListView.

using Gtk 4.0;
using Adw 1;

BuilderListItemFactory list_view_factory {
  template ListItem {
    child: Adw.Clamp list_width_clamp {
      orientation: horizontal;
      maximum-size: bind template.item as <$MyItem>.picture as <$MyPicture>.width;

      child: Picture pic {
        paintable: bind template.item as <$MyItem>.picture;
        height-request: bind template.item as <$MyItem>.picture as <$MyPicture>.height;
        content-fit: cover;
        vexpand: true;
      };
    };
  }
}

If I change the height property, the allocated height for each ListItem row stays the same. Emitting ListModel.items_changed does not affect it either.

Unsetting and resetting the factory for the ListView “works”, but that recreates all of the widgets, so it’s not exactly a great solution :rofl:

Any help or pointers are greatly appreciated. Thank you!! :heart:

EDIT: My property bindings were incorrect, as I wasn’t emitting notify. After fixing that, simply changing the property changes the size.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.