I know the GtkTreeListModel etc. is still work in progress.
But do we really have no way to track or query which items are expanded? I would love to save the expanded state during sessions (program sessions or sessions between kills of the container widget).
Ok,but why is this done via actions and not signals?
No surprise i could not find this one liner hidden in the API doc.
What is the action parameter? Why is this not documented.
Same why i dont understand why āGtkTreeListModelCreateModelFuncā is designed as a constructor function and not a signal.
What exactly are you doing? Can you post the code?
In Gtk4, a tree list is composed of several elements:
Data Object: an object to hold the data to be displayed (a string that will be displayed like an item, for example).
List: A Gio.ListStore or other list object that will contain the data objects.
Selection: the type of Gtk.Selection that can be made in the component (none, singleā¦), a List needs to be set as the model of the Gtk.Selection.
ItemFactory: an ItemFactory will create a widget to be displayed in the ListView (a Gtk.Label to display a string like an item, for example), and will add to it the objectās information in the List (the string that goes in the Gtk.Label). The ItemFactory can do this via signals or through the Builder. Gtk.SignalListItemFactory is easier to understand and creates the widgets through a āsetupā function, and connects the data object information to the widget through a ābindā function. Both are connected to ItemFactory through its ābindā and āsetupā signals.
Lastly, you need Gtk.ListView to display the widget created by the ItemFactory. Once all this is created, when you insert a Data Object into the List, the ItemFactory will call the āsetupā function, then the ābindā function, and the Gtk.ListView will display the widget for that item.
That said, GtkTreeListModelCreateModelFunc serves to create Models on demand to allocate the subitems of a treelist, whenever an item of the treelist is expanded or collapsed there will be a call to GtkTreeListModelCreateModelFunc. In the ābindā function, the state of the Gtk.TreeExpander must be connected to its respective Gtk.TreeListRow.