docs icon indicating copy to clipboard operation
docs copied to clipboard

ListBox with list models

Open danirabbit opened this issue 1 year ago • 0 comments

Problem

Frequently requested in Discord lately is how to work with Gtk.ListBox

Proposal

We should have a section that shows:

  • [ ] How to create a Gtk.ListBox bound to a ListModel with a CreateWidgetFunc
  • [ ] Granite style classes for lists like RICH_LIST and BOXED_LIST
  • [ ] How to sort and filter a list model
  • [ ] How to use placeholders
  • [ ] How to use header functions

I would probably do it in this order:

  1. Create a list of items and style it with rich_list and boxed_list
  2. Change the model to use a sort func
  3. Add a header func
  4. Add a search entry and connect it to a filter func. Maybe also use https://valadoc.org/gtk4/Gtk.SearchEntry.set_key_capture_widget.html while we’re here
  5. Add a placeholder for when there’s no search results

Prior Art (Optional)

No response

danirabbit avatar Dec 13 '24 04:12 danirabbit