docs
docs copied to clipboard
ListBox with list models
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:
- Create a list of items and style it with rich_list and boxed_list
- Change the model to use a sort func
- Add a header func
- 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
- Add a placeholder for when there’s no search results
Prior Art (Optional)
No response