Gtk.TreeListModel¶
class — extends GObject.Object, Gio.ListModel
A list model that can create child models on demand.
Constructors¶
new¶
@classmethod
def new(cls, root: Gio.ListModel, passthrough: bool, autoexpand: bool, create_func: TreeListModelCreateModelFunc) -> TreeListModel
Creates a new empty GtkTreeListModel displaying root
with all rows collapsed.
Parameters:
root— TheGListModelto use as rootpassthrough—Trueto pass through items from the modelsautoexpand—Trueto set the autoexpand property and expand therootmodelcreate_func— function to call to create theGListModelfor the children of an item
Methods¶
get_autoexpand¶
Gets whether the model is set to automatically expand new rows that get added.
This can be either rows added by changes to the underlying
models or via TreeListRow.set_expanded.
get_child_row¶
Gets the row item corresponding to the child at index position for
self's root model.
If position is greater than the number of children in the root model,
None is returned.
Do not confuse this function with TreeListModel.get_row.
Parameters:
position— position of the child to get
get_model¶
Gets the root model that self was created with.
get_passthrough¶
Gets whether the model is passing through original row items.
If this function returns False, the GListModel functions for self
return custom GtkTreeListRow objects. You need to call
TreeListRow.get_item on these objects to get the original
item.
If True, the values of the child models are passed through in their
original state. You then need to call TreeListModel.get_row
to get the custom GtkTreeListRows.
get_row¶
Gets the row object for the given row.
If position is greater than the number of items in self,
None is returned.
The row object can be used to expand and collapse rows as well as to inspect its position in the tree. See its documentation for details.
This row object is persistent and will refer to the current
item as long as the row is present in self, independent of
other rows being added or removed.
If self is set to not be passthrough, this function is
equivalent to calling g_list_model_get_item().
Do not confuse this function with TreeListModel.get_child_row.
Parameters:
position— the position of the row to fetch
set_autoexpand¶
Sets whether the model should autoexpand.
If set to True, the model will recursively expand all rows that
get added to the model. This can be either rows added by changes
to the underlying models or via TreeListRow.set_expanded.
Parameters:
autoexpand—Trueto make the model autoexpand its rows
Properties¶
autoexpand¶
If all rows should be expanded by default.
item_type¶
The type of items. See Gio.ListModel.get_item_type.
model¶
The root model displayed.
n_items¶
The number of items. See Gio.ListModel.get_n_items.
passthrough¶
Gets whether the model is in passthrough mode.
If False, the GListModel functions for this object return custom
TreeListRow objects. If True, the values of the child
models are pass through unmodified.